bevy: Resizing causes a crash on latest stable Nvidia driver 550

Bevy version

Affects both 0.13 and main (21adeb684261eacd39acecaa8b056e0b9e918268)

Relevant system information

cargo 1.76.0 (c84b36747 2024-01-18)
KDE desktop X11
AdapterInfo { name: "NVIDIA GeForce RTX 3070 Ti", vendor: 4318, device: 9346, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "550.54.14", backend: Vulkan }
SystemInfo { os: "Linux rolling EndeavourOS", kernel: "6.7.6-arch1-1", cpu: "AMD Ryzen 7 5800X3D 8-Core Processor", core_count: "8", memory: "31.3 GiB" }

What you did

Run cargo run --example window_resizing or pretty much any example. Then drag a window corner to resize.

What went wrong

Outputs this and crashes.

thread 'Compute Task Pool (6)' panicked at crates/bevy_render/src/view/window/mod.rs:357:26:
Error reconfiguring surface: Outdated
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
thread 'Compute Task Pool (1)' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError

Additional information

550 was very recently stabilized (https://www.phoronix.com/news/NVIDIA-550.54.14-Linux-Driver).

Everything starts working again if I downgrade to the 545 driver.

I tested an example from the winit repository cargo run --example window and there was no issues.

Other applications I use aren’t affected by this issue, so it might not be Nvidia’s fault.

Complete log of the bevy example with backtrace:

❯ RUST_BACKTRACE=1 cargo run --example window_resizing
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/examples/window_resizing`
2024-02-29T12:17:29.654613Z  INFO bevy_winit::system: Creating new window "App" (0v1)
2024-02-29T12:17:29.654883Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.1666666666666667    
2024-02-29T12:17:29.722909Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3070 Ti", vendor: 4318, device: 9346, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "550.54.14", backend: Vulkan }
2024-02-29T12:17:30.120325Z  INFO gilrs_core::platform::platform::gamepad: Gamepad /dev/input/event9 (Generic X-Box pad) connected.    
2024-02-29T12:17:30.203046Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling EndeavourOS", kernel: "6.7.6-arch1-1", cpu: "AMD Ryzen 7 5800X3D 8-Core Processor", core_count: "8", memory: "31.3 GiB" }
2024-02-29T12:17:30.215488Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
thread 'Compute Task Pool (6)' panicked at crates/bevy_render/src/view/window/mod.rs:357:26:
Error reconfiguring surface: Outdated
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::expect
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1030:23
   4: bevy_render::view::window::prepare_windows
             at ./crates/bevy_render/src/view/window/mod.rs:355:33
   5: core::ops::function::FnMut::call_mut
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:166:5
   6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:294:13
   7: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run::call_inner
             at ./crates/bevy_ecs/src/system/function_system.rs:661:21
   8: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4,F5,F6,F7,F8) .> Out>>::run
             at ./crates/bevy_ecs/src/system/function_system.rs:664:17
   9: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at ./crates/bevy_ecs/src/system/function_system.rs:504:19
  10: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::spawn_system_task::{{closure}}::{{closure}}
             at ./crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:621:26
  11: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
  12: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272:9
  13: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  14: __rust_try
  15: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  16: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  17: bevy_ecs::schedule::executor::multi_threaded::ExecutorState::spawn_system_task::{{closure}}
             at ./crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:614:23
  18: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::future::future::Future>::poll
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:297:9
  19: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:588:42
  20: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272:9
  21: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  22: __rust_try
  23: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  24: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  25: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:588:9
  26: async_executor::Executor::spawn::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:158:20
  27: async_task::raw::RawTask<F,T,S,M>::run::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:550:21
  28: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
  29: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272:9
  30: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  31: __rust_try
  32: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  33: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  34: async_task::raw::RawTask<F,T,S,M>::run
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:549:23
  35: async_task::runnable::Runnable<M>::run
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
  36: async_executor::Executor::run::{{closure}}::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:254:21
  37: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:449:33
  38: async_executor::Executor::run::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:261:32
  39: futures_lite::future::block_on::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:99:19
  40: std::thread::local::LocalKey<T>::try_with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270:16
  41: std::thread::local::LocalKey<T>::with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246:9
  42: futures_lite::future::block_on
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:78:5
  43: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:180:37
  44: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  45: __rust_try
  46: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  47: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  48: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:174:43
  49: std::thread::local::LocalKey<T>::try_with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270:16
  50: std::thread::local::LocalKey<T>::with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246:9
  51: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:167:25
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
thread 'Compute Task Pool (0)' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: bevy_render::pipelined_rendering::RenderAppChannels::recv::{{closure}}
             at ./crates/bevy_render/src/pipelined_rendering.rs:49:26
   5: bevy_render::pipelined_rendering::update_rendering::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./crates/bevy_render/src/pipelined_rendering.rs:185:60
   6: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::future::future::Future>::poll
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:297:9
   7: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:588:42
   8: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272:9
   9: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  10: __rust_try
  11: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  12: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  13: <futures_lite::future::CatchUnwind<F> as core::future::future::Future>::poll
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:588:9
  14: async_executor::Executor::spawn::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:158:20
  15: async_task::raw::RawTask<F,T,S,M>::run::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:550:21
  16: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
  17: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panic/unwind_safe.rs:272:9
  18: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  19: __rust_try
  20: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  21: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  22: async_task::raw::RawTask<F,T,S,M>::run
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/raw.rs:549:23
  23: async_task::runnable::Runnable<M>::run
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.0/src/runnable.rs:781:18
  24: async_executor::Executor::run::{{closure}}::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:254:21
  25: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:449:33
  26: async_executor::Executor::run::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-executor-1.8.0/src/lib.rs:261:32
  27: futures_lite::future::block_on::{{closure}}
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:99:19
  28: std::thread::local::LocalKey<T>::try_with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270:16
  29: std::thread::local::LocalKey<T>::with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246:9
  30: futures_lite::future::block_on
             at /home/eero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-2.2.0/src/future.rs:78:5
  31: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:180:37
  32: std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  33: __rust_try
  34: std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  35: std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  36: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:174:43
  37: std::thread::local::LocalKey<T>::try_with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:270:16
  38: std::thread::local::LocalKey<T>::with
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/thread/local.rs:246:9
  39: bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}
             at ./crates/bevy_tasks/src/task_pool.rs:167:25
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 20
  • Comments: 24 (19 by maintainers)

Commits related to this issue

Most upvoted comments

It seems to break when there are resizes in consecutive frames, as the outdated error is ignored only in the code path where there is no resize. I made a version where the outdated error is always ignored, and that seems to work perfectly. https://github.com/eero-lehtinen/bevy/tree/v0.13.0-nvidia-fix

I just ran into this myself. Arch linux with nvidia drivers 550.54.14-2.

Yep I tested winit upstream examples and found no issues. Now I also tested wgpu upstream examples and found no issues. Seems Bevy specific.

It seems to break when there are resizes in consecutive frames, as the outdated error is ignored only in the code path where there is no resize. I made a version where the outdated error is always ignored, and that seems to work perfectly. https://github.com/eero-lehtinen/bevy/tree/v0.13.0-nvidia-fix

This appears to work for me too. Arch Linux 6.7.9-arch1-1, i3, X11, Nvidia 550.54.14.

@eero-lehtinen could you try with this branch? https://github.com/mockersf/bevy/tree/nvidia-outdated

I’m not sure how that will behave, it may fix the issue or make it worse 😄

I’m not actually sure if our code is too eager. It’s just that with this specific driver surface.get_current_texture doesn’t work if called just after surface.configure (or it works once at startup but not on resize). Maybe as a workaround we could skip drawing a frame on resize? I’m not really familiar with bevy or wgpu internals though, just testing stuff out.

I did some more investigation and found that we call surface.get_current_texture() directly after WindowEvent::Resized, while wgpu examples only do it on WindowEvent::RedrawRequested. If I modify the wgpu examples to do that, they crash too.

I have the same issue on the newest nvidia drivers and X11

Also works on main if I disable the multi-threading feature as it disables pipelined rendering.

FYI @james7132 @hymm. Thanks a ton for bisecting!

Bisected the issue to the introduction of pipelined rendering 2027af4c54082007fed2091f112a11cb0bc5fc08 😃