emilk / emilk/egui

libwayland-client segfault introduced in a dep update

Open
#2,952 15 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**

Some time after `d486c76a9f146c12321b2a3fd0cedfe732e5783d` an updated dep (winit?) is now causing a segfault.
This happens only after I do a close and re-open of the window using `run_and_return`.

```
Thread 1 "rog-control-cen" received signal SIGSEGV, Segmentation fault.
0x00007ffff68cc3a9 in wl_list_insert () from /lib64/libwayland-client.so.0
Missing separate debuginfos, use: dnf debuginfo-install at-spi2-atk-2.48.0-1.fc38.x86_64 at-spi2-core-2.48.0-1.fc38.x86_64 atk-2.48.0-1.fc38.x86_64 bzip2-libs-1.0.8-13.fc38.x86_64 cairo-1.17.8-3.fc38.x86_64 cairo-gobject-1.17.8-3.fc38.x86_64 dbus-libs-1.14.6-1.fc38.x86_64 dconf-0.40.0-8.fc38.x86_64 elfutils-libelf-0.189-1.fc38.x86_64 expat-2.5.0-2.fc38.x86_64 fontconfig-2.14.2-1.fc38.x86_64 freetype-2.13.0-2.fc38.x86_64 fribidi-1.0.12-3.fc38.x86_64 gdk-pixbuf2-2.42.10-2.fc38.x86_64 glib2-2.76.1-1.fc38.x86_64 glibc-2.37-1.fc38.x86_64 graphite2-1.3.14-11.fc38.x86_64 gtk3-3.24.37-1.fc38.x86_64 harfbuzz-7.1.0-1.fc38.x86_64 json-glib-1.6.6-4.fc38.x86_64 libX11-1.8.4-1.fc38.x86_64 libX11-xcb-1.8.4-1.fc38.x86_64 libXau-1.0.11-2.fc38.x86_64 libXcomposite-0.4.5-9.fc38.x86_64 libXcursor-1.2.1-3.fc38.x86_64 libXdamage-1.1.5-9.fc38.x86_64 libXext-1.3.5-2.fc38.x86_64 libXfixes-6.0.0-5.fc38.x86_64 libXi-1.8-4.fc38.x86_64 libXinerama-1.1.5-2.fc38.x86_64 libXrender-0.9.11-2.fc38.x86_64 libappindicator-gtk3-12.10.1-1.fc38.x86_64 libblkid-2.38.1-4.fc38.x86_64 libcap-2.48-6.fc38.x86_64 libcloudproviders-0.3.1-7.fc38.x86_64 libdatrie-0.2.13-5.fc38.x86_64 libdbusmenu-16.04.0-21.fc38.x86_64 libdbusmenu-gtk3-16.04.0-21.fc38.x86_64 libdrm-2.4.114-2.fc38.x86_64 libedit-3.1-45.20221030cvs.fc38.x86_64 libepoxy-1.5.10-3.fc38.x86_64 libffi-3.4.4-2.fc38.x86_64 libgcc-13.0.1-0.12.fc38.x86_64 libglvnd-1.6.0-2.fc38.x86_64 libjpeg-turbo-2.1.4-2.fc38.x86_64 libmount-2.38.1-4.fc38.x86_64 libpciaccess-0.16-8.fc38.x86_64 libpng-1.6.37-14.fc38.x86_64 libstdc++-13.0.1-0.12.fc38.x86_64 libthai-0.1.29-4.fc38.x86_64 libtracker-sparql-3.5.0-1.fc38.x86_64 libwayland-client-1.22.0-1.fc38.x86_64 libwayland-cursor-1.22.0-1.fc38.x86_64 libwayland-egl-1.22.0-1.fc38.x86_64 libwayland-server-1.22.0-1.fc38.x86_64 libxcb-1.13.1-11.fc38.x86_64 libxkbcommon-1.5.0-2.fc38.x86_64 libxshmfence-1.3-12.fc38.x86_64 libzstd-1.5.5-1.fc38.x86_64 llvm-libs-16.0.0-2.fc38.x86_64 mesa-libEGL-23.0.2-2.fc38.x86_64 mesa-libgbm-23.0.2-2.fc38.x86_64 pango-1.50.14-1.fc38.x86_64 pixman-0.42.2-1.fc38.x86_64 sqlite-libs-3.40.1-2.fc38.x86_64 xz-libs-5.4.1-1.fc38.x86_64 zlib-1.2.13-3.fc38.x86_64
(gdb) bt
#0 0x00007ffff68cc3a9 in wl_list_insert () at /lib64/libwayland-client.so.0
#1 0x00007ffff68cdb7a in wl_display_read_events () at /lib64/libwayland-client.so.0
#2 0x000055555644ec70 in wayland_client::imp::event_queue::EventQueueInner::read_events (self=0x5555567e1160) at src/native_lib/event_queue.rs:118
#3 wayland_client::event_queue::ReadEventsGuard::read_events (self=...) at src/event_queue.rs:264
#4 0x0000555555e9ba2c in smithay_client_toolkit::event_loop::{impl#1}::process_events::{closure#0}>> () at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-client-toolkit-0.16.0/src/event_loop.rs:88
#5 calloop::sources::generic::{impl#2}::process_events>>>
(self=, readiness=..., token=..., callback=...) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.10.5/src/sources/generic.rs:121
#6 0x0000555555e7a98d in smithay_client_toolkit::event_loop::{impl#1}::process_events>> (self=, callback=..., readiness=..., token=...)
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-client-toolkit-0.16.0/src/event_loop.rs:84
#7 calloop::sources::{impl#4}::process_events> (self=, readiness=..., token=..., data=) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.10.5/src/sources/mod.rs:305
#8 0x0000555555e78456 in calloop::loop_logic::EventLoop::dispatch_events
(self=0x5555567e8ce0, timeout=..., data=0x5555567e8d88) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.10.5/src/loop_logic.rs:300
#9 0x0000555555e7907c in calloop::loop_logic::EventLoop::dispatch>
(self=0x5555567e8ce0, timeout=..., data=0x5555567e8d88) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/calloop-0.10.5/src/loop_logic.rs:415
#10 0x0000555555e86fad in winit::platform_impl::platform::wayland::event_loop::EventLoop::loop_dispatch> (self=, timeout=...)
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.3/src/platform_impl/linux/wayland/event_loop/mod.rs:598
#11 winit::platform_impl::platform::wayland::event_loop::EventLoop::run_return>
(self=, callback=...) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.3/src/platform_impl/linux/wayland/event_loop/mod.rs:327
#12 0x0000555555ea41de in winit::platform_impl::platform::EventLoop::run_return>
(self=0x7ffff5e45b68, callback=...) at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.3/src/platform_impl/linux/mod.rs:785
#13 winit::platform::run_return::{impl#0}::run_return> (self=0x7ffff5e45b68, event_handler=...)
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.28.3/src/platform/run_return.rs:51
#14 eframe::native::run::run_and_return (event_loop=0x7ffff5e45b68, winit_app=...) at src/native/run.rs:132
#15 eframe::native::run::glow_integration::run_glow::{closure#0} (event_loop=0x7ffff5e45b68, native_options=) at src/native/run.rs:1038
#16 eframe::native::run::with_event_loop::{closure#0}, eframe::native::run::glow_integration::run_glow::{closure_env#0}> (event_loop=) at src/native/run.rs:116
#17 std::thread::local::LocalKey>>>::try_with>>, eframe::native::run::with_event_loop::{closure_env#0}, eframe::native::run::glow_integration::run_glow::{closure_env#0}>, core::result::Result<(), eframe::Error>> (self=, f=...)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:445
#18 std::thread::local::LocalKey>>>::with>>, eframe::native::run::with_event_loop::{closure_env#0}, eframe::native::run::glow_integration::run_glow::{closure_env#0}>, core::result::Result<(), eframe::Error>> (self=, f=...)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:421
#19 0x0000555555ed0134 in eframe::native::run::with_event_loop, eframe::native::run::glow_integration::run_glow::{closure_env#0}> (f=..., native_options=)
at src/native/run.rs:109
#20 eframe::native::run::glow_integration::run_glow (app_name=..., native_options=..., app_creator=...) at src/native/run.rs:1035
#21 0x0000555555ed7fb3 in eframe::run_native (app_name=..., native_options=..., app_creator=...) at src/lib.rs:161
#22 0x0000555555b37287 in rog_control_center::start_app (states=..., native_options=...) at rog-control-center/src/main.rs:254
#23 rog_control_center::main () at rog-control-center/src/main.rs:197
#24 0x0000555555b31b36 in core::ops::function::FnOnce::call_once core::result::Result<(), rog_control_center::error::Error>, ()> () at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248
#25 std::sys_common::backtrace::__rust_begin_short_backtrace core::result::Result<(), rog_control_center::error::Error>, core::result::Result<(), rog_control_center::error::Error>> (f=0x5555570161c0)
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:122
#26 0x0000555555b31fd5 in std::rt::lang_start::{closure#0}> () at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/rt.rs:166
#27 0x000055555657698f in core::ops::function::impls::{impl#2}::call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/core/src/ops/function.rs:283
#28 std::panicking::try::do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panicking.rs:492
#29 std::panicking::try + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/std/src/panicking.rs:456
#30 std::panic::catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panic.rs:137
#31 std::rt::lang_start_internal::{closure#2} () at library/std/src/rt.rs:148
#32 std::panicking::try::do_call () at library/std/src/panicking.rs:492
#33 std::panicking::try () at library/std/src/panicking.rs:456
#34 std::panic::catch_unwind () at library/std/src/panic.rs:137
#35 std::rt::lang_start_internal () at library/std/src/rt.rs:148
#36 0x0000555555b38bbf in main ()
#37 0x00007ffff6d2cb4a in __libc_start_call_main () at /lib64/libc.so.6
#38 0x00007ffff6d2cc0b in __libc_start_main_impl () at /lib64/libc.so.6
#39 0x0000555555b2f6f5 in _start ()
(gdb) q
A debugging session is active.
```

**Desktop**
Operating System: Fedora Linux 38
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Kernel Version: 6.3.0-0.rc7.20230420gitcb0856346a60.59.fc38.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i9-12900H
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
System Version: 1.0

As I know which commit was good, I should be able to work from there with a git bisect and the serial-windows example.

Contributor guide

Open the contributing guide

Research direction

Start with the close-and-reopen path using run_and_return in src/native/run.rs, then inspect the winit and Wayland event-loop frames shown in the backtrace. Reproduce the sequence on Linux and trace the dependency change after d486c76a9f146c12321b2a3fd0cedfe732e5783d; done means reopening the window no longer segfaults in libwayland-client.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.