dimforge / parry

2D and 3D collision-detection library for Rust.
https://parry.rs
Apache License 2.0
529 stars 93 forks source link

New panic: 'attempt to add with overflow' in parry3d 0.13.3 #136

Closed LPGhatguy closed 1 year ago

LPGhatguy commented 1 year ago

Hi! We recently updated from rapier3d 0.15.0 to 0.17.2, which brought in a new version of parry3d with it.

In some of the scenes that worked in previous versions of rapier/parry, we're now hitting a new panic. This statement overflows and panics in debug builds: https://github.com/dimforge/parry/blob/071c7efb6a044c2c5706a7690a28c0f40f20fa13/src/partitioning/qbvh/update.rs#LL359C58-L359C58

Here is the relevant chunk of the panic stack frame:

17: parry3d::partitioning::qbvh::qbvh::GenericQbvh<rapier3d::geometry::collider_components::ColliderHandle,parry3d::utils::array::DefaultStorage>::rebalance<rapier3d::geometry::collider_components::ColliderHandle>
    at C:\Users\lucien\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.13.3\src\partitioning\qbvh\update.rs:359
18: rapier3d::pipeline::query_pipeline::QueryPipeline::update_incremental
    at C:\Users\lucien\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.17.2\src\pipeline\query_pipeline.rs:352
19: rapier3d::pipeline::physics_pipeline::PhysicsPipeline::step
    at C:\Users\lucien\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.17.2\src\pipeline\physics_pipeline.rs:624

It's been very tough to reproduce this issue consistently. I'll be working on a reproduction case, but I wanted to get this bug onto your radar sooner than later. If there's any specific information or debug hooks I can set up to help track down this issue, please let me know.

Additionally, we've hit an issue where rapier3d occasionally hangs indefinitely. I suspect that it might be related, but I'm unsure.

eldyer commented 1 year ago

I'm getting this panic too in my project after upgrading. Seems to be related to: https://github.com/dimforge/rapier/issues/450