dimforge / rapier

2D and 3D physics engines focused on performance.
https://rapier.rs
Apache License 2.0
3.97k stars 248 forks source link

Examples immediately freeze #528

Closed JoelCourtney closed 8 months ago

JoelCourtney commented 1 year ago

Hello, I am trying to get started and I'm unable to use the examples.

  1. run cargo run --release --bin all_examples2 or all_examples3
  2. simulation starts and runs for a few frames (inconsistent number of frames, but always less than a second).
  3. Simulation freezes and program becomes unresponsive. On macOS, the spinning ball is displayed. CPU usage is 100%.
  4. Have to end process with ctrl+c.

EDIT full output:

2023-10-04T05:06:03.294980Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2023-10-04T05:06:03.301442Z  INFO rapier_testbed2d::lines: Loaded 2d debug lines plugin.
Ughuuu commented 1 year ago

Same here, this is what the program prints:

cargo run --bin all_examples2
   Compiling rapier-examples-2d v0.1.0 (/Users/dragosdaian/Documents/rapier/examples2d)
    Finished dev [optimized + debuginfo] target(s) in 1.86s
     Running `target/debug/all_examples2`
2023-10-03T13:10:51.845503Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2023-10-03T13:10:51.852745Z  INFO rapier_testbed2d::lines: Loaded 2d debug lines plugin.
2023-10-03 15:10:51.941 all_examples2[17645:3936162] CAMetalLayer ignoring invalid setDrawableSize width=4294967295.000000 height=4294967295.000000
2023-10-03T13:10:51.942584Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `main_texture_a`
    Dimension X value 4294967295 exceeds the limit of 16384

', /Users/dragosdaian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.14.2/src/backend/direct.rs:2403:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/dragosdaian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.9.1/src/task_pool.rs:273:45
ickk commented 1 year ago

Experiencing the same problem on Windows 10. I bisected and found for me the first broken commit seems to be c4f078daf35d093c59905860296abb2ff3655a5c, which is where bevy is updated from 0.7 to 0.8

JoelCourtney commented 1 year ago

@Ughuuu I'm not seeing a panic on my system, so it sounds like you're experiencing a different issue. I'll update my post to include the output to avoid confusion. Can you open a separate issue?

@ickk Is it panicking on your system, or freezing without any error message, or something else?

ickk commented 1 year ago

@ickk Is it panicking on your system, or freezing without any error message, or something else?

For me it just hangs indefinitely, and seems to max out a single CPU core

Ughuuu commented 1 year ago

@Ughuuu I'm not seeing a panic on my system, so it sounds like you're experiencing a different issue. I'll update my post to include the output to avoid confusion. Can you open a separate issue?

@ickk Is it panicking on your system, or freezing without any error message, or something else?

Sometimes it also freezes on Mac, sometimes it crashes. On windows machine I can reproduce also the freeze.

hakolao commented 1 year ago

For me it just hangs indefinitely

same

Ughuuu commented 1 year ago

For anyone having this, until it's fixed, you can use this lock file, it works. Cargo.lock.zip

katopz commented 11 months ago

Same here, this is what the program prints:

cargo run --bin all_examples2
   Compiling rapier-examples-2d v0.1.0 (/Users/dragosdaian/Documents/rapier/examples2d)
    Finished dev [optimized + debuginfo] target(s) in 1.86s
     Running `target/debug/all_examples2`
2023-10-03T13:10:51.845503Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2023-10-03T13:10:51.852745Z  INFO rapier_testbed2d::lines: Loaded 2d debug lines plugin.
2023-10-03 15:10:51.941 all_examples2[17645:3936162] CAMetalLayer ignoring invalid setDrawableSize width=4294967295.000000 height=4294967295.000000
2023-10-03T13:10:51.942584Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `main_texture_a`
    Dimension X value 4294967295 exceeds the limit of 16384

', /Users/dragosdaian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.14.2/src/backend/direct.rs:2403:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/dragosdaian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.9.1/src/task_pool.rs:273:45

This issue can be fix by use bevy 0.11.3 refer to https://github.com/bevyengine/bevy/issues/9389 . IMHO this freeze issue can be resolve by migrate to bevy 0.11.3. And yes my macOS, Windows all freeze at start same as other ppl.

sebcrozet commented 8 months ago

That was fixed when the testbed got updated to bevy 0.11.