Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.5] Bevy sometimes does not terminate cleanly #1908

Closed
jusw85 opened this issue Apr 13, 2021 · 13 comments
Closed

[0.5] Bevy sometimes does not terminate cleanly #1908

jusw85 opened this issue Apr 13, 2021 · 13 comments
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior

Comments

@jusw85
Copy link

jusw85 commented Apr 13, 2021

Bevy version

0.5

Operating system & version

Arch Linux

What you did

After updating to 0.5, Bevy sometimes does not terminate even after closing the window.

Using the following example:

use bevy::prelude::*;

fn main() {
    App::build()
        .insert_resource(WindowDescriptor {
            width: 300.,
            height: 300.,
            ..Default::default()
        })
        .add_plugins(DefaultPlugins)
        .run();
}

out

In the video, I'm closing using Alt-F4. I have to Ctrl-C the third run of the executable. It happens often enough to be noticeable.

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 13, 2021

Can you attach a debugger when this happens and get a backtrace for all threads? For gdb this is thread apply all bt and for lldb bt all.

@bjorn3 bjorn3 added the C-Bug An unexpected or incorrect behavior label Apr 13, 2021
@jusw85
Copy link
Author

jusw85 commented Apr 13, 2021

Log
(gdb) r
Starting program: /home/user/Documents/CLionProjects/bevy-test/target/debug/test2 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff7878640 (LWP 31382)]
[New Thread 0x7ffff7677640 (LWP 31383)]
[New Thread 0x7ffff7476640 (LWP 31384)]
[New Thread 0x7ffff6c1d640 (LWP 31385)]
[New Thread 0x7ffff6c1d640 (LWP 31386)]
[Thread 0x7ffff6c1d640 (LWP 31385) exited]
[New Thread 0x7ffff641c640 (LWP 31387)]
[New Thread 0x7ffff621b640 (LWP 31388)]
[New Thread 0x7fffbe54f640 (LWP 31389)]
[Thread 0x7fffbe54f640 (LWP 31389) exited]
[New Thread 0x7fffbe54f640 (LWP 31390)]
[Thread 0x7fffbe54f640 (LWP 31390) exited]
[New Thread 0x7fffbe54f640 (LWP 31391)]
[Thread 0x7fffbe54f640 (LWP 31391) exited]
[New Thread 0x7fffbe54f640 (LWP 31392)]
[Thread 0x7fffbe54f640 (LWP 31392) exited]
[New Thread 0x7fffbe54f640 (LWP 31393)]
[Thread 0x7fffbe54f640 (LWP 31393) exited]
[New Thread 0x7fffbe54f640 (LWP 31394)]
[Thread 0x7ffff7677640 (LWP 31383) exited]
[Thread 0x7ffff7476640 (LWP 31384) exited]
[Thread 0x7ffff7878640 (LWP 31382) exited]
[Thread 0x7ffff641c640 (LWP 31387) exited]
[Thread 0x7ffff6c1d640 (LWP 31386) exited]
^C
Thread 1 "test2" received signal SIGINT, Interrupt.
0x00007ffff7c8e9ba in __futex_abstimed_wait_common64 () from /usr/lib/libpthread.so.0
(gdb) thread apply all bt

Thread 14 (Thread 0x7fffbe54f640 (LWP 31394) "test2"):
#0  0x00007ffff7a5937f in poll () from /usr/lib/libc.so.6
#1  0x00007ffff70fc63b in ?? () from /usr/lib/libxcb.so.1
#2  0x00007ffff70fe45b in xcb_wait_for_special_event () from /usr/lib/libxcb.so.1
#3  0x00007fffcc9f5ced in ?? () from /usr/lib/amdvlk64.so
#4  0x00007fffcca7d6e3 in ?? () from /usr/lib/amdvlk64.so
#5  0x00007fffcc9b142d in ?? () from /usr/lib/amdvlk64.so
#6  0x00007ffff7c82299 in start_thread () from /usr/lib/libpthread.so.0
#7  0x00007ffff7a64053 in clone () from /usr/lib/libc.so.6

Thread 8 (Thread 0x7ffff621b640 (LWP 31388) "test2"):
#0  0x00007ffff7a2c125 in clock_nanosleep@GLIBC_2.2.5 () from /usr/lib/libc.so.6
#1  0x00007ffff7a31357 in nanosleep () from /usr/lib/libc.so.6
#2  0x00005555586eed90 in std::sys::unix::thread::Thread::sleep () at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877//library/std/src/sys/unix/thread.rs:164
#3  std::thread::sleep () at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877//library/std/src/thread/mod.rs:792
#4  0x0000555557cbad6f in gilrs::ff::server::run (rx=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/gilrs-0.8.0/src/ff/server.rs:265
#5  0x0000555557cbb0d3 in gilrs::ff::server::init::{{closure}} () at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/gilrs-0.8.0/src/ff/server.rs:276
#6  0x0000555557ca1863 in std::sys_common::backtrace::__rust_begin_short_backtrace<closure-0,()> (f=...) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125
#7  0x0000555557ccec44 in std::thread::{{impl}}::spawn_unchecked::{{closure}}::{{closure}}<closure-0,()> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:474
#8  0x0000555557ca0e14 in std::panic::{{impl}}::call_once<(),closure-0> (self=..., _args=()) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:323
#9  0x0000555557ce382b in std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,()> (data=0x7ffff621a9e8) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:379
#10 0x0000555557ce7a7d in __rust_try ()
#11 0x0000555557ce377d in std::panicking::try<(),std::panic::AssertUnwindSafe<closure-0>> (f=...) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:343
#12 0x0000555557ca26c4 in std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,()> (f=...) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:410
#13 0x0000555557ccea60 in std::thread::{{impl}}::spawn_unchecked::{{closure}}<closure-0,()> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:473
#14 0x0000555557c9b6df in core::ops::function::FnOnce::call_once<closure-0,()> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
#15 0x00005555586fec8a in alloc::boxed::{{impl}}::call_once<(),FnOnce<()>,alloc::alloc::Global> () at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/alloc/src/boxed.rs:1488
#16 alloc::boxed::{{impl}}::call_once<(),alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>,alloc::alloc::Global> () at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/library/alloc/src/boxed.rs:1488
#17 std::sys::unix::thread::{{impl}}::new::thread_start () at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877//library/std/src/sys/unix/thread.rs:71
#18 0x00007ffff7c82299 in start_thread () from /usr/lib/libpthread.so.0
#19 0x00007ffff7a64053 in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff79559c0 (LWP 31381) "test2"):
#0  0x00007ffff7c8e9ba in __futex_abstimed_wait_common64 () from /usr/lib/libpthread.so.0
#1  0x00007ffff7c8ab98 in __new_sem_wait_slow64.constprop.0 () from /usr/lib/libpthread.so.0
#2  0x00007fffcc9d2f72 in ?? () from /usr/lib/amdvlk64.so
#3  0x00007fffcc850f24 in ?? () from /usr/lib/amdvlk64.so
#4  0x0000555556d82cde in ash::vk::extensions::KhrSwapchainFn::destroy_swapchain_khr (self=0x7ffffffde188, device=..., swapchain=..., p_allocator=0x0) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ash-0.31.0/src/vk/extensions.rs:612
#5  0x0000555556d7bb86 in ash::extensions::khr::swapchain::Swapchain::destroy_swapchain (self=0x7ffffffde180, swapchain=..., allocation_callbacks=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ash-0.31.0/src/extensions/khr/swapchain.rs:37
#6  0x0000555556d22df0 in gfx_backend_vulkan::window::{{impl}}::unconfigure_swapchain (self=0x55555951bff8, device=0x555559269c18) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/window.rs:403
#7  0x0000555556590feb in wgpu_core::hub::Hub<gfx_backend_vulkan::Backend, wgpu_core::hub::IdentityManagerFactory>::clear<gfx_backend_vulkan::Backend,wgpu_core::hub::IdentityManagerFactory> (self=0x555558e99638, surface_guard=0x555558e99608, with_adapters=true) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-core-0.7.1/src/hub.rs:709
#8  0x000055555657a001 in wgpu_core::hub::{{impl}}::drop<wgpu_core::hub::IdentityManagerFactory> (self=0x555558e99510) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-core-0.7.1/src/hub.rs:800
#9  0x0000555556852516 in core::ptr::drop_in_place<wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#10 0x00005555568478c5 in core::ptr::drop_in_place<wgpu::backend::direct::Context> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#11 0x00005555567eb724 in alloc::sync::Arc<wgpu::backend::direct::Context>::drop_slow<wgpu::backend::direct::Context> (self=0x55555926ce70) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1043
#12 0x00005555567ec81f in alloc::sync::{{impl}}::drop<wgpu::backend::direct::Context> (self=0x55555926ce70) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1575
#13 0x000055555684dbcf in core::ptr::drop_in_place<alloc::sync::Arc<wgpu::backend::direct::Context>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#14 0x0000555556550aff in core::ptr::drop_in_place<wgpu::Queue> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#15 0x0000555556551986 in core::ptr::drop_in_place<bevy_wgpu::wgpu_renderer::WgpuRenderer> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#16 0x0000555556552fdf in core::ptr::drop_in_place<closure-0> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#17 0x000055555852addc in core::ptr::drop_in_place<alloc::boxed::Box<FnMut<(&mut bevy_ecs::world::World)>, alloc::alloc::Global>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#18 0x000055555852e646 in core::ptr::drop_in_place<bevy_ecs::system::exclusive_system::ExclusiveSystemFn> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#19 0x000055555852830c in core::ptr::drop_in_place<alloc::boxed::Box<ExclusiveSystem, alloc::alloc::Global>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#20 0x000055555852f8e6 in core::ptr::drop_in_place<bevy_ecs::schedule::system_container::ExclusiveSystemContainer> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#21 0x0000555558530941 in core::ptr::drop_in_place<[bevy_ecs::schedule::system_container::ExclusiveSystemContainer]> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#22 0x00005555584d8925 in alloc::vec::{{impl}}::drop<bevy_ecs::schedule::system_container::ExclusiveSystemContainer,alloc::alloc::Global> (self=0x555558d9e5c0) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2354
--Type <RET> for more, q to quit, c to continue without paging--
#23 0x0000555558528486 in core::ptr::drop_in_place<alloc::vec::Vec<bevy_ecs::schedule::system_container::ExclusiveSystemContainer, alloc::alloc::Global>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#24 0x000055555852d6fd in core::ptr::drop_in_place<bevy_ecs::schedule::stage::SystemStage> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#25 0x000055555841148c in core::ptr::drop_in_place<alloc::boxed::Box<Stage, alloc::alloc::Global>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#26 0x00005555584107c1 in core::ptr::drop_in_place<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#27 0x00005555584113ae in core::ptr::mut_ptr::{{impl}}::drop_in_place<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)> (self=0x555558d24de0) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mut_ptr.rs:985
#28 0x0000555558404a0f in hashbrown::raw::Bucket<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)>::drop<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)> (self=0x7fffffff8e78) at /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.9.0/src/raw/mod.rs:334
#29 0x000055555840424a in hashbrown::raw::{{impl}}::drop<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)> (self=0x7fffffff9a98) at /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.9.0/src/raw/mod.rs:1325
#30 0x00005555584107df in core::ptr::drop_in_place<hashbrown::raw::RawTable<(alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>)>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#31 0x0000555558410806 in core::ptr::drop_in_place<hashbrown::map::HashMap<alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>, ahash::random_state::RandomState>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#32 0x000055555841081f in core::ptr::drop_in_place<std::collections::hash::map::HashMap<alloc::boxed::Box<StageLabel, alloc::alloc::Global>, alloc::boxed::Box<Stage, alloc::alloc::Global>, ahash::random_state::RandomState>> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#33 0x0000555558410b16 in core::ptr::drop_in_place<bevy_ecs::schedule::Schedule> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#34 0x00005555584108e6 in core::ptr::drop_in_place<bevy_app::app::App> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#35 0x00005555571e54ef in core::ptr::drop_in_place<closure-1> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179
#36 0x000055555722f6c9 in winit::platform_impl::platform::x11::EventLoop<()>::run_return<(),closure-1> (self=0x7fffffff9dc8, callback=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:392
#37 0x000055555722fddf in winit::platform_impl::platform::x11::EventLoop<()>::run<(),closure-1> (self=..., callback=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:398
#38 0x000055555721546c in winit::platform_impl::platform::EventLoop<()>::run<(),closure-1> (self=..., callback=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:652
#39 0x00005555571c1ca7 in winit::event_loop::EventLoop<()>::run<(),closure-1> (self=..., event_handler=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/event_loop.rs:154
#40 0x00005555571dbcf7 in bevy_winit::run<closure-1> (event_loop=..., event_handler=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.5.0/src/lib.rs:171
#41 0x00005555571dc498 in bevy_winit::winit_runner_with (app=..., event_loop=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.5.0/src/lib.rs:493
#42 0x00005555571dbda2 in bevy_winit::winit_runner (app=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.5.0/src/lib.rs:211
#43 0x00005555571e34c1 in core::ops::function::Fn::call<fn(bevy_app::app::App),(bevy_app::app::App)> () at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:70
#44 0x000055555841206a in alloc::boxed::{{impl}}::call<(bevy_app::app::App),Fn<(bevy_app::app::App)>,alloc::alloc::Global> (self=0x7fffffffcc70, args=...) at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1502
#45 0x000055555840f967 in bevy_app::app::App::run (self=...) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app.rs:68
#46 0x0000555558416b55 in bevy_app::app_builder::AppBuilder::run (self=0x7fffffffd8b8) at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.5.0/src/app_builder.rs:49
#47 0x00005555564a20c9 in test2::main () at /home/user/Documents/CLionProjects/bevy-test/src/bin/test2.rs:5

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 13, 2021

Maybe a race condition in wgpu or gfx-rs?

@bjorn3 bjorn3 added the A-Rendering Drawing game state to the screen label Apr 13, 2021
@bjorn3
Copy link
Contributor

bjorn3 commented Apr 13, 2021

Can you open an issue at https://github.com/gfx-rs/wgpu?

@jusw85
Copy link
Author

jusw85 commented Apr 13, 2021

Can you open an issue at https://github.com/gfx-rs/wgpu?

I'm not familiar enough with wgpu nor the internals of how bevy interfaces with wgpu via bevy_wgpu to file an informed bug report with the wgpu project.

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 13, 2021

Found an issue for what seems to be the same problem: https://github.com/gfx-rs/wgpu-rs/issues/584

@jusw85
Copy link
Author

jusw85 commented Apr 13, 2021

I ran a git bisect and identified the problematic commit b71ada0

If I change this line from wgpu::PresentMode::Fifo back to wgpu::PresentMode::Mailbox, I don't have the issue anymore.

@bjorn3
Copy link
Contributor

bjorn3 commented Apr 13, 2021

Can you comment that on gfx-rs/wgpu-rs#584? Might be useful for them.

@alice-i-cecile alice-i-cecile added the A-Windowing Platform-agnostic interface layer to run your app in label Apr 14, 2021
@GiantBlargg
Copy link

GiantBlargg commented Jan 9, 2022

This seems to be a mesa bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/176.

X11 doesn't like it when the swapchain is deleted after the window.

@rademonster
Copy link

For anyone else who comes across this thread looking for information on bevy hangups:
I had deadlocks in the middle of execution and when closing the app.
I didn't think to save my back traces (from attaching gdb to the hung process). But If i remember correctly, in all cases it had something to do with the vulkan SwapChain.
Switching to Mailbox present mode did not help.
I am running Ubuntu on Intel i7-7700HQ.

The only thing that got the issue to go away was switching back to my discrete Nvidia GPU.

Looks like there are some Intel specific issues with the vk driver. Though this PR should have fixed at least one of them.
gfx-rs/wgpu#2212

Some other relevant links:
gfx-rs/wgpu#1898
gfx-rs/wgpu#1446

For my issue at least, the likelihood of the deadlock increased with the complexity of the scene so it is also possible that my beefier GPU is hiding the issue. Though, I just loaded enough geometry into my scene to tank the frame rate, and it still ran without locking up. I also had the deadlock when closing a window with no geometry in it, and that is gone.

Hope this helps someone.

@nicopap
Copy link
Contributor

nicopap commented Mar 26, 2022

So we ran into this issue making Warlock's Gambit (developed on linux) The workaround was to disable vsync

Workaround

code for bevy 0.6:

app.insert_resource(WindowDescriptor { vsync: false, ..Default::default() })
  // rest of app initialization

code for bevy 0.7:

app.insert_resource(WindowDescriptor { present_mode: PresentMode::Immediate, ..Default::default() })
  // rest of app initialization

Note that you can disable vsync specifically for linux by adding the #[cfg(target_os="linux")] attribute to the field or expression.

Obviously this is far from ideal because then your game will chug your CPU and GPU as much as it can, but it's the best way to prevent hangs on exits. Which perturbed my workflow a major deal.

@dvogel
Copy link

dvogel commented Apr 24, 2022

Since this is a vulkan-specific bug, if you're not relying on any vulkan-specific features, you can override the wgpu backend with WGPU_BACKEND=gl cargo run.

@nicopap
Copy link
Contributor

nicopap commented Apr 3, 2023

This issue seems similar to #5524, which is now fixed. I assume this is also fixed. If anyone can reproduce in bevy 0.10.0, please speak up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

7 participants