bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Closing window doesn't end process

Open A-Walrus opened this issue 1 year ago • 12 comments

Bevy version

0.12.1, as well as main at time of writing: b6945e5332df2bc5934c198044acd290c744d9fb

If your bug is rendering-related, copy the adapter info that appears when you run Bevy.

2024-02-10T16:18:05.493890Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics", vendor: 4098, device: 5761, device_type: IntegratedGpu, driver: "AMD open-source driver", driver_info: "2024.Q1.1 (LLPC)", backend: Vulkan }
2024-02-10T16:18:05.877320Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling EndeavourOS", kernel: "6.6.16-1-lts", cpu: "", core_count: "8", memory: "30.6 GiB" }

Tested the winit window example and it works fine

What you did

Ran any bevy app, for example the sprite example. Pressed the X button in the top bar of the app.

What went wrong

Process stayed open, had to be killed through Ctrl+C, or through system monitor.

Expected: process closes.

Additional information

This happened both on Wayland and Xorg.

A-Walrus avatar Feb 10 '24 16:02 A-Walrus

I think you are using the AMDVLK driver. You might want to try the Mesa Radeon drivers, RADV. They are generally better supported. Try uninstalling the amdvlk package and installing vulkan-radeon instead.

Friz64 avatar Feb 10 '24 20:02 Friz64

Switch to the vulkan-radeon driver and now the process closes, although with a panic

Encountered a panic in system `bevy_render::view::window::prepare_windows`!
thread 'main' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError

A-Walrus avatar Feb 10 '24 21:02 A-Walrus

~~Interesting, this is probably #11734, although your error message is different. Does this happen on both Wayland and X11?~~ This is #11734.

Friz64 avatar Feb 10 '24 21:02 Friz64

Happens with xwayland. When running on wayland with wayland feature enabled it works correctly, seems to be the same issue as you said

A-Walrus avatar Feb 10 '24 22:02 A-Walrus

It's interesting that (apparently/probably) since #11737 got merged, it now panics a second time. This is the full message:

thread 'Compute Task Pool (14)' panicked at crates/bevy_render/src/view/window/mod.rs:368:21:
Couldn't get swap chain texture, operation unrecoverable: The swap chain has been lost and needs to be recreated
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 (14)' panicked at crates/bevy_render/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError

That's why I didn't immediately recognize the error.

Friz64 avatar Feb 10 '24 22:02 Friz64

I'm seeing the same original problem with the recommended drivers, hangs after closing without panic.

2024-02-19T20:41:39.728702Z  INFO log: Guessed window scale factor: 1.6666666666666667    
2024-02-19T20:41:39.832922Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics (RADV GFX1103_R1)", vendor: 4098, device: 5567, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 24.0.1 - kisak-mesa PPA", backend: Vulkan }
2024-02-19T20:41:40.162962Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.10 Ubuntu", kernel: "6.5.0-17-generic", cpu: "AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics", core_count: "8", memory: "27.1 GiB" }
2024-02-19T20:41:44.080514Z  INFO bevy_window::system: No windows are open, exiting
2024-02-19T20:41:44.081244Z  INFO bevy_winit::system: Closing window 0v1```

mwbryant avatar Feb 19 '24 20:02 mwbryant

Seeing this same issue on Ubuntu after updating to 0.13 (was not an issue on 0.12.1):

2024-02-22T20:32:44.335631Z  INFO log: Guessed window scale factor: 1.1666666666666667
2024-02-22T20:32:44.405722Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 5700 XT (RADV NAVI10)", vendor: 4098, device: 29471, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.2.1-1ubuntu3.1", backend: Vulkan }
2024-02-22T20:32:44.608342Z  INFO log: Gamepad /dev/input/event7 (Microsoft X-Box 360 pad) connected.    
2024-02-22T20:32:44.625949Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.10 Ubuntu", kernel: "6.5.0-17-lowlatency", cpu: "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz", core_count: "4", memory: "15.6 GiB" }
2024-02-22T20:32:44.628695Z  INFO bevy_input::gamepad: Gamepad { id: 0 } Connected
2024-02-22T20:32:50.037479Z  INFO bevy_window::system: No windows are open, exiting
2024-02-22T20:32:50.043979Z  INFO bevy_winit::system: Closing window 0v1

After which the process hangs indefinitely until force-quit.

grimace87 avatar Feb 22 '24 20:02 grimace87

gonna throw in my little insight, i have had this issue since 0.13 (on xwayland) as well, panicking when user closes the main window and also on bevy::window::close_on_esc. however, it does not happen when dependencies are built without optimisation. it is a graceful shutdown with no opt-level in [profile.dev.package."*"] in Cargo.toml.

mochou-p avatar Mar 01 '24 20:03 mochou-p

Can confirm removing the opt-level as @mochou-p described lets it shut down gracefully with Process finished with exit code 0.

grimace87 avatar Mar 01 '24 21:03 grimace87

another thing i just found out: having 2 games open, both with bevy::window::close_on_esc in Update, with both of them being the latest focused windows in the OS, pressing [Escape] will close both, the top one will panic, and the bottom one will shutdown gracefully. (bevy 0.13, xwayland)

mochou-p avatar Mar 09 '24 15:03 mochou-p

Same for me... (bevy 0.13.1 and 0.13.2)

goto40 avatar Apr 06 '24 15:04 goto40

Duplicate of #10260.

Friz64 avatar May 09 '24 19:05 Friz64

Fixed in #13236, can be closed.

Friz64 avatar May 12 '24 16:05 Friz64