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

Segfault on exit with multi_threaded feature disabled on Wayland after wgpu 0.20 #13958

Open
Friz64 opened this issue Jun 20, 2024 · 0 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Regression Functionality that used to work but no longer does. Add a test for this! O-Linux Specific to the Linux desktop operating system P-Crash A sudden unexpected crash

Comments

@Friz64
Copy link
Contributor

Friz64 commented Jun 20, 2024

Bevy version

Any version after #13186

Relevant system information

2024-06-20T21:14:40.889656Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux rolling Arch Linux", kernel: "6.9.5-arch1-1", cpu: "AMD Ryzen 9 7900X 12-Core Processor", core_count: "12", memory: "30.6 GiB" }
2024-06-20T21:14:40.922798Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 7900 GRE (RADV NAVI31)", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.1.1-arch1.1", backend: Vulkan }

GNOME desktop, most likely not relevant though IMO

What you did

Ran bevy examples without the multi_threaded feature (and without the sysinfo_plugin feature, but that's #13957)

diff --git a/Cargo.toml b/Cargo.toml
index 8211f5665..afd2b5c08 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,17 +69,16 @@ default = [
   "bevy_sprite",
   "bevy_text",
   "bevy_ui",
-  "multi_threaded",
   "png",
   "hdr",
   "vorbis",
   "x11",
+  "wayland",
   "bevy_gizmos",
   "android_shared_stdcxx",
   "tonemapping_luts",
   "default_font",
   "webgl2",
-  "sysinfo_plugin",
 ]

cargo run --example 3d_scene

What went wrong

fish: Job 1, 'cargo run --example 3d_scene' terminated by signal SIGSEGV (Address boundary error)
Backtrace from GDB
(gdb) bt
#0  0x00007ffff7f6782c in ?? () from /usr/lib/libwayland-client.so.0
#1  0x00007ffff7f67985 in ?? () from /usr/lib/libwayland-client.so.0
#2  0x00007ffff7f69717 in wl_proxy_marshal_array_flags () from /usr/lib/libwayland-client.so.0
#3  0x00007ffff7f6a2fb in wl_proxy_marshal_flags () from /usr/lib/libwayland-client.so.0
#4  0x00007fffec496394 in ?? () from /usr/lib/libEGL_mesa.so.0
#5  0x00007fffec48ad59 in ?? () from /usr/lib/libEGL_mesa.so.0
#6  0x00007fffec48b3e1 in ?? () from /usr/lib/libEGL_mesa.so.0
#7  0x00007fffec477e9e in ?? () from /usr/lib/libEGL_mesa.so.0
#8  0x000055555a7692f0 in khronos_egl::{impl#97}::eglTerminate<libloading::safe::Library> (self=0x55555b9d0d90, display=0x55555ead32b0)
    at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/src/lib.rs:2321
#9  khronos_egl::Instance<khronos_egl::Dynamic<libloading::safe::Library, khronos_egl::EGL1_4>>::terminate<khronos_egl::Dynamic<libloading::safe::Library, khronos_egl::EGL1_4>> (self=0x55555b9d0d90, display=...) at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/src/lib.rs:1181
#10 0x000055555a7f5dcb in wgpu_hal::gles::egl::terminate_display (egl=0x55555b9d0d90, display=...) at src/gles/egl.rs:471
#11 0x000055555a7f9011 in wgpu_hal::gles::egl::{impl#10}::drop (self=0x55555d5ab5d0) at src/gles/egl.rs:669
#12 0x000055555a7aa717 in core::ptr::drop_in_place<wgpu_hal::gles::egl::Inner> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#13 0x000055555a61749b in core::ptr::drop_in_place<core::cell::UnsafeCell<wgpu_hal::gles::egl::Inner>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#14 0x000055555a6027bf in core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, wgpu_hal::gles::egl::Inner>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#15 0x000055555a613c6c in core::ptr::drop_in_place<wgpu_hal::gles::egl::Instance> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#16 0x000055555a617a03 in core::ptr::drop_in_place<core::option::Option<wgpu_hal::gles::egl::Instance>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#17 0x000055555a613b4a in core::ptr::drop_in_place<wgpu_core::instance::Instance> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#18 0x000055555a389b17 in core::ptr::drop_in_place<wgpu_core::global::Global> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#19 0x000055555a38abf4 in core::ptr::drop_in_place<wgpu::backend::wgpu_core::ContextWgpuCore> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#20 0x000055555a38a3d0 in core::ptr::drop_in_place<dyn wgpu::context::DynContext> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#21 0x000055555a3b8aea in alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>::drop_slow<dyn wgpu::context::DynContext, alloc::alloc::Global> (
    self=0x55555e357ae0) at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:1812
#22 0x000055555a3bcef0 in alloc::sync::{impl#34}::drop<dyn wgpu::context::DynContext, alloc::alloc::Global> (self=0x55555e357ae0)
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:2470
#23 0x000055555a38c7eb in core::ptr::drop_in_place<alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#24 0x00005555599805e7 in core::ptr::drop_in_place<wgpu::BindGroupLayout> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#25 0x00005555595c331f in alloc::sync::Arc<wgpu::BindGroupLayout, alloc::alloc::Global>::drop_slow<wgpu::BindGroupLayout, alloc::alloc::Global> (self=0x7fffffff8bd8)
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:1812
#26 0x000055555998cb82 in alloc::sync::{impl#34}::drop<wgpu::BindGroupLayout, alloc::alloc::Global> (self=0x7fffffff8bd8)
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:2470
#27 0x000055555998419b in core::ptr::drop_in_place<alloc::sync::Arc<wgpu::BindGroupLayout, alloc::alloc::Global>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#28 0x0000555559998c6c in bevy_render::render_resource::bind_group_layout::{impl#18}::drop (self=0x55555e3584f0)
    at crates/bevy_render/src/render_resource/resource_macros.rs:61
#29 0x00005555599897fb in core::ptr::drop_in_place<bevy_render::render_resource::bind_group_layout::ErasedBindGroupLayout> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#30 0x000055555998863b in core::ptr::drop_in_place<bevy_render::render_resource::bind_group_layout::BindGroupLayout> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#31 0x0000555558239232 in core::ptr::drop_in_place<bevy_gizmos::pipeline_3d::LineJointGizmoPipeline> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#32 0x00005555581f3b0c in core::ptr::mut_ptr::{impl#0}::drop_in_place<bevy_gizmos::pipeline_3d::LineJointGizmoPipeline> (self=0x55555e358410)
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mut_ptr.rs:1466
#33 bevy_ptr::OwningPtr<bevy_ptr::Aligned>::drop_as<bevy_ptr::Aligned, bevy_gizmos::pipeline_3d::LineJointGizmoPipeline> (self=...) at crates/bevy_ptr/src/lib.rs:445
#34 0x000055555821257b in bevy_ecs::component::ComponentDescriptor::drop_ptr<bevy_gizmos::pipeline_3d::LineJointGizmoPipeline> (x=...)
    at crates/bevy_ecs/src/component.rs:512
#35 0x000055555b04ab62 in bevy_ecs::storage::blob_vec::BlobVec::clear (self=0x55555e6129c0) at crates/bevy_ecs/src/storage/blob_vec.rs:436
#36 0x000055555b0d76d2 in bevy_ecs::storage::blob_vec::{impl#2}::drop (self=0x55555e6129c0) at crates/bevy_ecs/src/storage/blob_vec.rs:444
#37 0x000055555b0ced9b in core::ptr::drop_in_place<bevy_ecs::storage::blob_vec::BlobVec> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#38 0x000055555b07b49b in core::mem::manually_drop::ManuallyDrop<bevy_ecs::storage::blob_vec::BlobVec>::drop<bevy_ecs::storage::blob_vec::BlobVec> (
    slot=0x55555e6129c0) at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/mem/manually_drop.rs:144
#39 0x000055555b0d77b3 in bevy_ecs::storage::resource::{impl#0}::drop<true> (self=0x55555e6129c0) at crates/bevy_ecs/src/storage/resource.rs:38
#40 0x000055555b0d0207 in core::ptr::drop_in_place<bevy_ecs::storage::resource::ResourceData<true>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#41 0x000055555b0d0d81 in core::ptr::drop_in_place<[bevy_ecs::storage::resource::ResourceData<true>]> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#42 0x000055555b0d2453 in alloc::vec::{impl#25}::drop<bevy_ecs::storage::resource::ResourceData<true>, alloc::alloc::Global> (self=0x55555db694d8)
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/vec/mod.rs:3283
#43 0x000055555b0d1a67 in core::ptr::drop_in_place<alloc::vec::Vec<bevy_ecs::storage::resource::ResourceData<true>, alloc::alloc::Global>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#44 0x000055555b0cbd37 in core::ptr::drop_in_place<bevy_ecs::storage::sparse_set::SparseSet<bevy_ecs::component::ComponentId, bevy_ecs::storage::resource::ResourceData<true>>> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#45 0x000055555b0cfedb in core::ptr::drop_in_place<bevy_ecs::storage::resource::Resources<true>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#46 0x000055555b0ce397 in core::ptr::drop_in_place<bevy_ecs::storage::Storages> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#47 0x000055555b0cdecb in core::ptr::drop_in_place<bevy_ecs::world::World> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#48 0x000055555b011617 in core::ptr::drop_in_place<bevy_app::sub_app::SubApp> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#49 0x000055555b0111cf in core::ptr::drop_in_place<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp)> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#50 0x000055555b030a1d in core::ptr::mut_ptr::{impl#0}::drop_in_place<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp)> (
    self=0x55555db69370) at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mut_ptr.rs:1466
#51 hashbrown::raw::inner::Bucket<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp)>::drop<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp)> (self=0x7fffffff9008)
    at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:590
#52 0x000055555b030267 in hashbrown::raw::inner::RawTableInner::drop_elements<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp)> (
    self=0x7fffffffa6e0) at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:2377
#53 0x000055555b0302b0 in hashbrown::raw::inner::RawTableInner::drop_inner_table<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp), allocator_api2::stable::alloc::global::Global> (self=0x7fffffffa6e0, alloc=0x7fffffffa700, table_layout=...)
    at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:2432
#54 0x000055555b01237c in hashbrown::raw::inner::{impl#17}::drop<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp), allocator_api2::stable::alloc::global::Global> (self=0x7fffffffa6e0) at /home/friz64/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/raw/mod.rs:3690
#55 0x000055555b0112ab in core::ptr::drop_in_place<hashbrown::raw::inner::RawTable<(bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp), allocator_api2::stable::alloc::global::Global>> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#56 0x000055555b01122b in core::ptr::drop_in_place<hashbrown::map::HashMap<bevy_ecs::intern::Interned<dyn bevy_app::app::AppLabel>, bevy_app::sub_app::SubApp, core::hash::BuildHasherDefault<ahash::fallback_hash::AHasher>, allocator_api2::stable::alloc::global::Global>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#57 0x000055555b011752 in core::ptr::drop_in_place<bevy_app::sub_app::SubApps> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#58 0x000055555b011557 in core::ptr::drop_in_place<bevy_app::app::App> () at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#59 0x000055555717de27 in core::ptr::drop_in_place<bevy_winit::state::WinitAppRunnerState<bevy_winit::WakeUp>> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514
#60 0x00005555571d88ef in bevy_winit::state::winit_runner<bevy_winit::WakeUp> (app=...) at crates/bevy_winit/src/state.rs:762
#61 0x0000555557179190 in core::ops::function::FnOnce::call_once<fn(bevy_app::app::App) -> bevy_app::app::AppExit, (bevy_app::app::App)> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250
#62 0x0000555557178e82 in core::ops::function::FnOnce::call_once<fn(bevy_app::app::App) -> bevy_app::app::AppExit, (bevy_app::app::App)> ()
    at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250
#63 0x000055555b01dce9 in alloc::boxed::{impl#48}::call_once<(bevy_app::app::App), dyn core::ops::function::FnOnce<(bevy_app::app::App), Output=bevy_app::app::AppExit>, alloc::alloc::Global> (self=..., args=...) at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2022
#64 0x000055555b01e537 in bevy_app::app::App::run (self=0x7fffffffda88) at crates/bevy_app/src/app.rs:169
#65 0x0000555557101955 in 3d_scene::main () at examples/3d/3d_scene.rs:6

TLDR: It segfaults in eglTerminate.

The game was rendered using Vulkan, yet wgpu still had an OpenGL context lying around that was used for adapter enumeration.

Additional information

I'm not sure how many people use Bevy without the multi_threaded feature on the Desktop. This probably isn't the highest priority issue.

@Friz64 Friz64 added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 20, 2024
@janhohenheim janhohenheim added P-Crash A sudden unexpected crash O-Linux Specific to the Linux desktop operating system C-Regression Functionality that used to work but no longer does. Add a test for this! A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Jun 25, 2024
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 C-Bug An unexpected or incorrect behavior C-Regression Functionality that used to work but no longer does. Add a test for this! O-Linux Specific to the Linux desktop operating system P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

2 participants