gfx-rs/wgpu

Segmentation fault on exit

dhardy opened this issue · 3 comments

Description
Since updating to v0.20.0, I get a segmentation fault on exit. Backtrace:

Thread 1 "clock" received signal SIGSEGV, Segmentation fault.
0x00007ffff7fb7d2c in wl_map_insert_at (map=map@entry=0x5555575b2300, flags=flags@entry=1, i=39, data=<optimized out>) at ../src/wayland-util.c:276
276             start[i].next |= (flags & 0x1) << 1;                                                                                                       
(gdb) bt
#0  0x00007ffff7fb7d2c in wl_map_insert_at (map=map@entry=0x5555575b2300, flags=flags@entry=1, i=39, data=<optimized out>) at ../src/wayland-util.c:276
#1  0x00007ffff7fb7e85 in proxy_destroy (proxy=proxy@entry=0x555557dc70c0) at ../src/wayland-client.c:538
#2  0x00007ffff7fb9b17 in wl_proxy_destroy_caller_locks (proxy=0x555557dc70c0) at ../src/wayland-client.c:562
#3  wl_proxy_marshal_array_flags (proxy=proxy@entry=0x555557dc70c0, opcode=opcode@entry=0, interface=interface@entry=0x0, version=version@entry=4, 
    flags=flags@entry=1, args=args@entry=0x7fffffff60b0) at ../src/wayland-client.c:900
#4  0x00007ffff7fba61a in wl_proxy_marshal_flags (proxy=proxy@entry=0x555557dc70c0, opcode=opcode@entry=0, interface=interface@entry=0x0, version=4, 
    flags=flags@entry=1) at ../src/wayland-client.c:823
#5  0x00007ffff7299a6e in wl_buffer_destroy (wl_buffer=0x555557dc70c0) at /usr/include/wayland-client-protocol.h:2035
#6  dri2_teardown_wayland (dri2_dpy=dri2_dpy@entry=0x555557d75910) at ../src/egl/drivers/dri2/platform_wayland.c:2830
#7  0x00007ffff728ea90 in dri2_display_destroy (disp=disp@entry=0x555557d77210) at ../src/egl/drivers/dri2/egl_dri2.c:1259
#8  0x00007ffff728efb0 in dri2_display_release (disp=0x555557d77210) at ../src/egl/drivers/dri2/egl_dri2.c:1209
#9  dri2_display_release (disp=0x555557d77210) at ../src/egl/drivers/dri2/egl_dri2.c:1194
#10 dri2_terminate (disp=0x555557d77210) at ../src/egl/drivers/dri2/egl_dri2.c:1347
#11 0x00007ffff727be0c in eglTerminate (dpy=<optimized out>) at ../src/egl/main/eglapi.c:768
#12 0x0000555556688010 in khronos_egl::{impl#97}::eglTerminate<libloading::safe::Library> (self=0x55555764cb00, display=0x555557d77210)
    at /home/dhardy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/src/lib.rs:2321
#13 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=0x55555764cb00, display=...)
    at /home/dhardy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/src/lib.rs:1181
#14 0x0000555556731a7b in wgpu_hal::gles::egl::terminate_display (egl=0x55555764cb00, display=...) at src/gles/egl.rs:471
#15 0x0000555556714931 in wgpu_hal::gles::egl::{impl#10}::drop (self=0x55555766ed20) at src/gles/egl.rs:669
#16 0x0000555556709357 in core::ptr::drop_in_place<wgpu_hal::gles::egl::Inner> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#17 0x0000555556526bab in core::ptr::drop_in_place<core::cell::UnsafeCell<wgpu_hal::gles::egl::Inner>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#18 0x0000555556511f4f in core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, wgpu_hal::gles::egl::Inner>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#19 0x00005555565233ac in core::ptr::drop_in_place<wgpu_hal::gles::egl::Instance> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#20 0x0000555556527113 in core::ptr::drop_in_place<core::option::Option<wgpu_hal::gles::egl::Instance>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#21 0x000055555652328a in core::ptr::drop_in_place<wgpu_core::instance::Instance> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#22 0x00005555561a33c7 in core::ptr::drop_in_place<wgpu_core::global::Global> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#23 0x00005555561a4914 in core::ptr::drop_in_place<wgpu::backend::wgpu_core::ContextWgpuCore> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#24 0x00005555561a3f00 in core::ptr::drop_in_place<dyn wgpu::context::DynContext> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#25 0x000055555629150a in alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>::drop_slow<dyn wgpu::context::DynContext, alloc::alloc::Global> (self=0x7fffffff6ad8) at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/alloc/src/sync.rs:1812
#26 0x00005555561a9f40 in alloc::sync::{impl#34}::drop<dyn wgpu::context::DynContext, alloc::alloc::Global> (self=0x7fffffff6ad8)
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/alloc/src/sync.rs:2470
#27 0x00005555561a673b in core::ptr::drop_in_place<alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#28 0x00005555560c3897 in core::ptr::drop_in_place<wgpu::Sampler> () at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#29 0x00005555560c4636 in core::ptr::drop_in_place<kas_wgpu::draw::atlases::Pipeline<kas_wgpu::draw::text_pipe::Instance>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#30 0x0000555555d873f7 in core::ptr::drop_in_place<kas_wgpu::draw::text_pipe::Pipeline> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#31 0x0000555555d882ac in core::ptr::drop_in_place<kas_wgpu::draw::DrawPipe<()>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#32 0x0000555555d82eaa in core::ptr::drop_in_place<kas_core::draw::draw_shared::SharedState<kas_wgpu::draw::DrawPipe<()>>> ()
    at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#33 0x0000555555d84c8c in core::ptr::drop_in_place<kas_core::app::shared::AppSharedState<(), kas_wgpu::WgpuBuilder<()>, kas_core::theme::simple_theme::SimpleTheme>> () at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#34 0x0000555555d849b3 in core::ptr::drop_in_place<kas_core::app::shared::AppState<(), kas_wgpu::WgpuBuilder<()>, kas_core::theme::simple_theme::SimpleTheme>> () at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#35 0x0000555555d8494e in core::ptr::drop_in_place<kas_core::app::event_loop::Loop<(), kas_wgpu::WgpuBuilder<()>, kas_core::theme::simple_theme::SimpleTheme>> () at /rustc/244da22fabd9fa677bbd0ac601a88e5ca6917526/library/core/src/ptr/mod.rs:514
#36 0x0000555555db1cc1 in kas_core::app::app::Application<(), kas_wgpu::WgpuBuilder<()>, kas_core::theme::simple_theme::SimpleTheme>::run<(), kas_wgpu::WgpuBuilder<()>, kas_core::theme::simple_theme::SimpleTheme> (self=...) at crates/kas-core/src/app/app.rs:217
#37 0x0000555555d9bb80 in clock::main () at examples/clock.rs:178

A clear and concise description of what the bug is.

Repro steps
Run a KAS example such as clock and exit.

I confirmed that this still occurs with the latest commit (fb3b33d) and ran a bisect which points to cbace63.

Platform

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon Graphics (radeonsi, navi22, LLVM 18.1.1, DRM 3.57, 6.8.7-300.fc40.x86_64) (0x73df)
    Version: 24.0.5
    Accelerated: yes
    Video memory: 10240MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2

I also confirm this bug.