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

The library segfaults when I close a window. #2687

Open
4 tasks done
Oglo12 opened this issue Dec 5, 2024 · 6 comments
Open
4 tasks done

The library segfaults when I close a window. #2687

Oglo12 opened this issue Dec 5, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Oglo12
Copy link

Oglo12 commented Dec 5, 2024

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

I was running the examples, and after every example, the code would segfault when I close the window.

Could it be because of Wayland?

What is the expected behavior?

Uh... to close the window, but not because of a segmentation fault.

Version

master

Operating System

Linux

Do you have any log output?

Segmentation fault (core dumped)
@Oglo12 Oglo12 added the bug Something isn't working label Dec 5, 2024
@At11011
Copy link

At11011 commented Dec 14, 2024

I have this problem as well. I am running Ubuntu 24.04, cargo 1.83.0 (5ffbef321 2024-10-29), rustc 1.83.0 (90b35a623 2024-11-26).

When you click the 'x' at the top right (for example in the bezier_tool example (compiled and ran by cargo run --prbezier_tool:

Screenshot from 2024-12-14 11-30-35

You get this output in debug and release mode (release mode by adding the --release flag in the cargo command above:
Screenshot from 2024-12-14 11-31-23
Screenshot from 2024-12-14 11-32-55

It would be good to know if there is a way to get the program to exit more gracefully. Especially if producing a release-ready app, it really should not be segfaulting every time it closes.

Considering this is happening in repository examples, I suspect it is more of a bug than expected behavior.

@MikMuellerDev
Copy link

Same on Nixos

@njust
Copy link

njust commented Dec 15, 2024

Same on Ubuntu 22.04 (master and the 0.13.1 release). I've noticed that it doesn't segfault when the tiny-skia renderer is used.

@Koranir
Copy link
Contributor

Koranir commented Dec 16, 2024

Could be relevant: gfx-rs/wgpu#4650

Might be fixable by switching the drop order of the wgpu Surface and winit Window.

@Koranir
Copy link
Contributor

Koranir commented Dec 16, 2024

Potentially relevant backtrace:

#0  0x00007ffff7faf88c in wl_map_insert_at (map=map@entry=0x555557cbc120, flags=flags@entry=1, i=45, data=<optimized out>) at ../wayland-1.23.1/src/wayland-util.c:290
#1  0x00007ffff7fafa01 in proxy_destroy (proxy=proxy@entry=0x5555583fd570) at ../wayland-1.23.1/src/wayland-client.c:574
#2  0x00007ffff7fb17c7 in wl_proxy_destroy_caller_locks (proxy=0x5555583fd570) at ../wayland-1.23.1/src/wayland-client.c:598
#3  wl_proxy_marshal_array_flags (proxy=proxy@entry=0x5555583fd570, opcode=opcode@entry=0, interface=interface@entry=0x0, version=version@entry=4, flags=flags@entry=1, args=args@entry=0x7fffffff96b0) at ../wayland-1.23.1/src/wayland-client.c:943
#4  0x00007ffff7fb23bb in wl_proxy_marshal_flags (proxy=proxy@entry=0x5555583fd570, opcode=opcode@entry=0, interface=interface@entry=0x0, version=4, flags=flags@entry=1) at ../wayland-1.23.1/src/wayland-client.c:857
#5  0x00007ffff4b32a64 in zwp_linux_dmabuf_feedback_v1_destroy (zwp_linux_dmabuf_feedback_v1=0x5555583fd570) at src/libnvidia-egl-wayland.so.1.1.17.p/linux-dmabuf-unstable-v1-client-protocol.h:1076
#6  wlEglDestroyFeedback (feedback=0x5555583fcba0) at ../egl-wayland/src/wayland-egldisplay.c:163
#7  terminateDisplay (display=display@entry=0x5555583fcab0, globalTeardown=globalTeardown@entry=0) at ../egl-wayland/src/wayland-egldisplay.c:734
#8  0x00007ffff4b3465c in wlEglTerminateHook (dpy=<optimized out>) at ../egl-wayland/src/wayland-egldisplay.c:779
#9  0x00007ffff44ae700 in ?? () from /usr/lib/libEGL_nvidia.so.0
#10 0x00007ffff4449a97 in ?? () from /usr/lib/libEGL_nvidia.so.0
#11 0x00005555575c02c0 in khronos_egl::{impl#97}::eglTerminate<libloading::safe::Library> (self=0x555557d74970, display=0x5555583fcab0) at /home/koranir/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/khronos-egl-6.0.0/src/lib.rs:2321
#12 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=0x555557d74970, display=...)
    at /home/koranir/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/khronos-egl-6.0.0/src/lib.rs:1181
#13 0x00005555575447f6 in wgpu_hal::gles::egl::terminate_display (egl=0x555557d74970, display=...) at src/gles/egl.rs:501
#14 0x00005555575482d1 in wgpu_hal::gles::egl::{impl#11}::drop (self=0x555558161208) at src/gles/egl.rs:718
#15 0x00005555574e3077 in core::ptr::drop_in_place<wgpu_hal::gles::egl::Inner> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#16 0x00005555574e569b in core::ptr::drop_in_place<core::cell::UnsafeCell<wgpu_hal::gles::egl::Inner>> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#17 0x00005555574e02ff in core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, wgpu_hal::gles::egl::Inner>> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#18 0x00005555574e34bc in core::ptr::drop_in_place<wgpu_hal::gles::egl::Instance> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#19 0x000055555729ad44 in core::ptr::drop_in_place<alloc::boxed::Box<dyn wgpu_hal::dynamic::instance::DynInstance, alloc::alloc::Global>> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#20 0x000055555728a36f in core::ptr::drop_in_place<(wgpu_types::Backend, alloc::boxed::Box<dyn wgpu_hal::dynamic::instance::DynInstance, alloc::alloc::Global>)> ()
    at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#21 0x000055555728bc7e in core::ptr::drop_in_place<[(wgpu_types::Backend, alloc::boxed::Box<dyn wgpu_hal::dynamic::instance::DynInstance, alloc::alloc::Global>)]> ()
    at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#22 0x0000555557249d63 in alloc::vec::{impl#25}::drop<(wgpu_types::Backend, alloc::boxed::Box<dyn wgpu_hal::dynamic::instance::DynInstance, alloc::alloc::Global>), alloc::alloc::Global> (self=0x5555581603a8)
    at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3754
#23 0x000055555728cf87 in core::ptr::drop_in_place<alloc::vec::Vec<(wgpu_types::Backend, alloc::boxed::Box<dyn wgpu_hal::dynamic::instance::DynInstance, alloc::alloc::Global>), alloc::alloc::Global>> ()
    at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#24 0x000055555729049c in core::ptr::drop_in_place<wgpu_core::instance::Instance> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#25 0x00005555571dbc04 in core::ptr::drop_in_place<wgpu_core::global::Global> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#26 0x00005555571dcb04 in core::ptr::drop_in_place<wgpu::backend::wgpu_core::ContextWgpuCore> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#27 0x00005555571dc15d in core::ptr::drop_in_place<dyn wgpu::context::DynContext> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#28 0x0000555557202990 in alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>::drop_slow<dyn wgpu::context::DynContext, alloc::alloc::Global> (self=0x555557cdcc70)
    at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1885
#29 0x0000555557202fbd in alloc::sync::{impl#37}::drop<dyn wgpu::context::DynContext, alloc::alloc::Global> (self=0x555557cdcc70) at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2572
#30 0x00005555571dd64b in core::ptr::drop_in_place<alloc::sync::Arc<dyn wgpu::context::DynContext, alloc::alloc::Global>> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#31 0x00005555568aa3c7 in core::ptr::drop_in_place<wgpu::api::bind_group_layout::BindGroupLayout> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#32 0x000055555688a36c in core::ptr::drop_in_place<iced_wgpu::triangle::gradient::Pipeline> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#33 0x0000555556889557 in core::ptr::drop_in_place<iced_wgpu::triangle::Pipeline> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#34 0x000055555616f6bb in core::ptr::drop_in_place<iced_wgpu::engine::Engine> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522
#35 0x0000555556170c7c in core::ptr::drop_in_place<iced_wgpu::window::compositor::Compositor> () at /home/koranir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:522

@Koranir
Copy link
Contributor

Koranir commented Dec 16, 2024

Interestingly, it doesn't segfault if I set the WGPU_BACKEND environment variable to 'gl' or 'vulkan'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants