Failing assertion within the velocity solver
Hello. I have updated Rapier to the newest version 0.32.0, which came with an unexpected bug that makes the game unplayable.
Occasionally, an internal assertion would fail.
My only enabled features are `simd-stable` and `parallel`.
Update: even without those features, the issue persists.
Here is the backtrace to help find and fix this bug:
```
thread '<unnamed>' (23083) panicked at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/dynamics/solver/velocity_solver.rs:113:17:
assertion `left == right` failed
left: 1
right: 25
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:80:14
2: core::panicking::assert_failed_inner
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:444:17
3: core::panicking::assert_failed
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:399:5
4: rapier2d::dynamics::solver::velocity_solver::VelocitySolver::init_solver_velocities_and_solver_bodies
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/dynamics/solver/velocity_solver.rs:113:17
5: rapier2d::dynamics::solver::island_solver::IslandSolver::init_and_solve
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/dynamics/solver/island_solver.rs:63:14
6: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::build_islands_and_solve_velocity_constraints::{{closure}}::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/pipeline/physics_pipeline.rs:319:32
7: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:274:22
8: core::iter::traits::iterator::Iterator::for_each::call::{{closure}}
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:825:29
9: <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::fold
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/zip.rs:286:25
10: <core::iter::adapters::zip::Zip<A,B> as core::iter::traits::iterator::Iterator>::fold
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/zip.rs:103:9
11: core::iter::traits::iterator::Iterator::for_each
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:828:14
12: <rayon::iter::for_each::ForEachConsumer<F> as rayon::iter::plumbing::Folder<T>>::consume_iter
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/for_each.rs:55:26
13: rayon::iter::plumbing::Producer::fold_with
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/plumbing/mod.rs:107:16
14: rayon::iter::plumbing::bridge_producer_consumer::helper
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/plumbing/mod.rs:432:22
15: rayon::iter::plumbing::bridge_producer_consumer
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/plumbing/mod.rs:391:12
16: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/plumbing/mod.rs:368:13
17: <<rayon::iter::enumerate::Enumerate<I> as rayon::iter::IndexedParallelIterator>::with_producer::Callback<CB> as rayon::iter::plumbing::ProducerCallback<I>>::callback
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/enumerate.rs:73:31
18: <rayon::slice::IterMut<T> as rayon::iter::IndexedParallelIterator>::with_producer
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/slice/mod.rs:983:18
19: <rayon::iter::enumerate::Enumerate<I> as rayon::iter::IndexedParallelIterator>::with_producer
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/enumerate.rs:57:26
20: rayon::iter::plumbing::bridge
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/plumbing/mod.rs:352:21
21: <rayon::iter::enumerate::Enumerate<I> as rayon::iter::ParallelIterator>::drive_unindexed
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/enumerate.rs:33:9
22: rayon::iter::for_each::for_each
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/for_each.rs:12:8
23: rayon::iter::ParallelIterator::for_each
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/mod.rs:377:9
24: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::build_islands_and_solve_velocity_constraints::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/pipeline/physics_pipeline.rs:307:22
25: rayon_core::scope::scope::{{closure}}::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/scope/mod.rs:284:52
26: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:274:9
27: std::panicking::catch_unwind::do_call
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:590:40
28: __rust_try
29: std::panicking::catch_unwind
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:553:19
30: std::panic::catch_unwind
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
31: rayon_core::unwind::halt_unwinding
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/unwind.rs:17:5
32: rayon_core::scope::ScopeBase::execute_job_closure
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/scope/mod.rs:693:28
33: rayon_core::scope::ScopeBase::complete
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/scope/mod.rs:671:31
34: rayon_core::scope::scope::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/scope/mod.rs:284:20
35: rayon_core::registry::Registry::in_worker_cold::{{closure}}::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:531:21
36: rayon_core::job::JobResult<T>::call::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/job.rs:218:41
37: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:274:9
38: std::panicking::catch_unwind::do_call
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:590:40
39: __rust_try
40: std::panicking::catch_unwind
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:553:19
41: std::panic::catch_unwind
at /home/let/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
42: rayon_core::unwind::halt_unwinding
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/unwind.rs:17:5
43: rayon_core::job::JobResult<T>::call
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/job.rs:218:15
44: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/job.rs:120:32
45: rayon_core::job::JobRef::execute
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/job.rs:64:9
46: rayon_core::registry::WorkerThread::execute
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:866:13
47: rayon_core::registry::WorkerThread::wait_until_cold
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:800:26
48: rayon_core::registry::WorkerThread::wait_until
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:775:18
49: rayon_core::registry::WorkerThread::wait_until_out_of_work
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:824:14
50: rayon_core::registry::main_loop
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:929:19
51: rayon_core::registry::ThreadBuilder::run
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:50:18
52: <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.13.0/src/registry.rs:95:27
```
Without features:
```
assertion `left == right` failed
left: 1
right: 28
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:80:14
2: core::panicking::assert_failed_inner
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:444:17
3: core::panicking::assert_failed
at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:399:5
4: rapier2d::dynamics::solver::velocity_solver::VelocitySolver::init_solver_velocities_and_solver_bodies
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/dynamics/solver/velocity_solver.rs:113:17
5: rapier2d::dynamics::solver::island_solver::IslandSolver::init_and_solve
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/dynamics/solver/island_solver.rs:63:14
6: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::build_islands_and_solve_velocity_constraints
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/pipeline/physics_pipeline.rs:267:47
7: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::step
at /home/let/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rapier2d-0.32.0/src/pipeline/physics_pipeline.rs:679:18
8: let_engine_core::objects::physics::Physics::step
at /home/let/code/let-engine/core/src/objects/physics/mod.rs:66:26
9: let_engine_core::scenes::Scene<T>::physics_iteration
at /home/let/code/let-engine/core/src/scenes.rs:419:31
10: let_engine::tick_system::run
at /home/let/code/let-engine/let-engine/src/tick_system.rs:57:18
11: let_engine::engine::Engine<G,E,B>::start::{{closure}}
at /home/let/code/let-engine/let-engine/src/engine.rs:302:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
4 条评论