ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.99k stars 198 forks source link

Vkcube crashes on wayland session #1451

Open sergio-fferreira opened 1 month ago

sergio-fferreira commented 1 month ago

GPU: integrated AMD + dedicated Nvidia RTX3060 mobile Desktop: KDE Plasma 6.0.5 Wayland

Running gamescope vkcube produces the following output:

console: gamescope version 3.14.22
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
vulkan: selecting physical device 'NVIDIA GeForce RTX 3060 Laptop GPU': queue family 2 (general queue family 0)
vulkan: physical device supports DRM format modifiers
wlserver: [backend/headless/backend.c:67] Creating headless backend
xdg_backend: Seat name: 
vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   RG16 (0x36314752)
vulkan:   NV12 (0x3231564E)
vulkan:   AB4H (0x48344241)
vulkan:   XB4H (0x48344258)
vulkan:   AB30 (0x30334241)
vulkan:   XB30 (0x30334258)
vulkan:   AR30 (0x30335241)
vulkan:   XR30 (0x30335258)
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:17] Starting headless backend
wlserver: Successfully initialized libei for input emulation!
wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use
wlserver: [xwayland/server.c:107] Starting Xwayland on :2
wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x5be4d20f7900 (res 0x5be4d20f8640)
wlserver: [xwayland/server.c:272] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 73
xwm: Embedded, no cursor set. Using left_ptr by default.
vblank: Using timerfd.
(EE) failed to read Wayland events: Broken pipe
zsh: IOT instruction (core dumped)  gamescope vkcube

Gamescope works as expected in a X11 session.

Thanks in advance.

sharkautarch commented 1 month ago

@sergio-fferreira Does it still crash if you run gamescope with: --backend sdl

sergio-fferreira commented 1 month ago

No, it doesn't. Should I use the sdl backend instead?

Loganbogan9 commented 1 month ago

I feel I may be having a similar issue. When trying to run BeamNG on Steam with the Vulkan backend Gamescope doesn't always crash, but may hang indefinitely needing a full reboot, randomly start stuttering, or lead to refresh rate control and other settings being completely broken until reboot.

sharkautarch commented 1 month ago

@sergio-fferreira well for now, yeah Tho do note that you should also be putting in gamescope --backend sdl -- vkcube instead of gamescope --backend sdl vkcube tho that’s probably not what’s causing your issue. It may be an nvidia-specific issue happening only on the wayland backend

From the log, it looks like gamescope is crashing somewhere (and not the app running under gamescope)

Could you please post the coredump message from gamescope, which you can get by running: coredumpctl info /usr/bin/gamescope

sergio-fferreira commented 1 month ago
Sure. This is the output of the latest bump (not all bumps): ``` PID: 9394 (gamescope-wl) UID: 1000 (boss) GID: 1000 (boss) Signal: 6 (ABRT) Timestamp: Sat 2024-08-03 20:24:54 WEST (4min 40s ago) Command Line: gamescope vkcube Executable: /usr/bin/gamescope Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@cfcd9a6026894d10a3ffbf84db271025.service Unit: user@1000.service User Unit: app-org.kde.konsole@cfcd9a6026894d10a3ffbf84db271025.service Slice: user-1000.slice Owner UID: 1000 (boss) Boot ID: eb024dda6c9d433f9bd39713ac4fe6ba Machine ID: 5bc000a173eb49d28ba70662d8195179 Hostname: manjaro-laptop Storage: /var/lib/systemd/coredump/core.gamescope-wl.1000.eb024dda6c9d433f9bd39713ac4fe6ba.9394.1722713094000000.zst (present) Size on Disk: 3.5M Message: Process 9394 (gamescope-wl) of user 1000 dumped core. Stack trace of thread 9397: #0 0x00007f8e80fbde44 n/a (libc.so.6 + 0x94e44) #1 0x00007f8e80f65a30 raise (libc.so.6 + 0x3ca30) #2 0x00007f8e80f4d4c3 abort (libc.so.6 + 0x244c3) #3 0x00005eb1655118d5 n/a (gamescope + 0x338d5) #4 0x00007f8e812e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9396: #0 0x00007f8e8103f4e2 epoll_wait (libc.so.6 + 0x1164e2) #1 0x00005eb165644236 n/a (gamescope + 0x166236) #2 0x00005eb16554046c n/a (gamescope + 0x6246c) #3 0x00007f8e812e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84) #4 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #5 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9399: #0 0x00007f8e8103ce9d syscall (libc.so.6 + 0x113e9d) #1 0x00007f8e809f7a10 g_cond_wait (libglib-2.0.so.0 + 0xb7a10) #2 0x00007f8e8096590c n/a (libglib-2.0.so.0 + 0x2590c) #3 0x00007f8e809d16b7 n/a (libglib-2.0.so.0 + 0x916b7) #4 0x00007f8e809cc266 n/a (libglib-2.0.so.0 + 0x8c266) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9404: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbaed9 pthread_cond_wait (libc.so.6 + 0x91ed9) #2 0x00007f8e516941ee n/a (libvulkan_radeon.so + 0x2941ee) #3 0x00007f8e5166d1ac n/a (libvulkan_radeon.so + 0x26d1ac) #4 0x00007f8e5169411d n/a (libvulkan_radeon.so + 0x29411d) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9394: #0 0x00007f8e8103139d __poll (libc.so.6 + 0x10839d) #1 0x00005eb16550509d n/a (gamescope + 0x2709d) #2 0x00007f8e80f4ec88 n/a (libc.so.6 + 0x25c88) #3 0x00007f8e80f4ed4c __libc_start_main (libc.so.6 + 0x25d4c) #4 0x00005eb16550c185 n/a (gamescope + 0x2e185) Stack trace of thread 9401: #0 0x00007f8e8103ce9d syscall (libc.so.6 + 0x113e9d) #1 0x00007f8e809f8367 g_cond_wait_until (libglib-2.0.so.0 + 0xb8367) #2 0x00007f8e809658d5 n/a (libglib-2.0.so.0 + 0x258d5) #3 0x00007f8e809d227b n/a (libglib-2.0.so.0 + 0x9227b) #4 0x00007f8e809cc266 n/a (libglib-2.0.so.0 + 0x8c266) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9407: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbb242 pthread_cond_timedwait (libc.so.6 + 0x92242) #2 0x00007f8e695f331c n/a (libnvidia-glcore.so.550.100 + 0x9f331c) #3 0x00007f8e69a3d041 n/a (libnvidia-glcore.so.550.100 + 0xe3d041) #4 0x00007f8e695f57d4 n/a (libnvidia-glcore.so.550.100 + 0x9f57d4) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9420: #0 0x00007f8e80fc31d8 pthread_sigmask (libc.so.6 + 0x9a1d8) #1 0x00007f8e80f65cbd sigprocmask (libc.so.6 + 0x3ccbd) #2 0x00007f8e8049de8b n/a (libdecor-gtk.so + 0x5e8b) #3 0x00007f8e8049e5b8 n/a (libdecor-gtk.so + 0x65b8) #4 0x00007f8e804a0e56 n/a (libdecor-gtk.so + 0x8e56) #5 0x00007f8e804a0f56 n/a (libdecor-gtk.so + 0x8f56) #6 0x00007f8e815002bc libdecor_frame_set_visibility (libdecor-0.so.0 + 0x52bc) #7 0x00005eb165513d46 n/a (gamescope + 0x35d46) #8 0x00005eb16553c9a8 n/a (gamescope + 0x5e9a8) #9 0x00005eb165541440 n/a (gamescope + 0x63440) #10 0x00007f8e812e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84) #11 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #12 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9395: #0 0x00007f8e8103f4e2 epoll_wait (libc.so.6 + 0x1164e2) #1 0x00005eb165644236 n/a (gamescope + 0x166236) #2 0x00005eb1655491f8 n/a (gamescope + 0x6b1f8) #3 0x00007f8e812e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84) #4 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #5 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9403: #0 0x00007f8e8103139d __poll (libc.so.6 + 0x10839d) #1 0x00007f8e809fe92d n/a (libglib-2.0.so.0 + 0xbe92d) #2 0x00007f8e8099bfc5 g_main_context_iteration (libglib-2.0.so.0 + 0x5bfc5) #3 0x00007f8e755b22fe n/a (libdconfsettings.so + 0x62fe) #4 0x00007f8e809cc266 n/a (libglib-2.0.so.0 + 0x8c266) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9419: #0 0x00007f8e8103139d __poll (libc.so.6 + 0x10839d) #1 0x00005eb165578a73 n/a (gamescope + 0x9aa73) #2 0x00007f8e812e0c84 execute_native_thread_routine (libstdc++.so.6 + 0xe0c84) #3 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #4 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9406: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbb242 pthread_cond_timedwait (libc.so.6 + 0x92242) #2 0x00007f8e695f331c n/a (libnvidia-glcore.so.550.100 + 0x9f331c) #3 0x00007f8e69a2c201 n/a (libnvidia-glcore.so.550.100 + 0xe2c201) #4 0x00007f8e695f57d4 n/a (libnvidia-glcore.so.550.100 + 0x9f57d4) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9402: #0 0x00007f8e8103139d __poll (libc.so.6 + 0x10839d) #1 0x00007f8e809fe92d n/a (libglib-2.0.so.0 + 0xbe92d) #2 0x00007f8e8099d7b7 g_main_loop_run (libglib-2.0.so.0 + 0x5d7b7) #3 0x00007f8e75f45574 n/a (libgio-2.0.so.0 + 0x112574) #4 0x00007f8e809cc266 n/a (libglib-2.0.so.0 + 0x8c266) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9400: #0 0x00007f8e8103139d __poll (libc.so.6 + 0x10839d) #1 0x00007f8e809fe92d n/a (libglib-2.0.so.0 + 0xbe92d) #2 0x00007f8e8099bfc5 g_main_context_iteration (libglib-2.0.so.0 + 0x5bfc5) #3 0x00007f8e8099c01a n/a (libglib-2.0.so.0 + 0x5c01a) #4 0x00007f8e809cc266 n/a (libglib-2.0.so.0 + 0x8c266) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9408: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbaed9 pthread_cond_wait (libc.so.6 + 0x91ed9) #2 0x00007f8e695f32bc n/a (libnvidia-glcore.so.550.100 + 0x9f32bc) #3 0x00007f8e69a26bb5 n/a (libnvidia-glcore.so.550.100 + 0xe26bb5) #4 0x00007f8e695f57d4 n/a (libnvidia-glcore.so.550.100 + 0x9f57d4) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9410: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbb242 pthread_cond_timedwait (libc.so.6 + 0x92242) #2 0x00007f8e695f331c n/a (libnvidia-glcore.so.550.100 + 0x9f331c) #3 0x00007f8e69a109fd n/a (libnvidia-glcore.so.550.100 + 0xe109fd) #4 0x00007f8e695f57d4 n/a (libnvidia-glcore.so.550.100 + 0x9f57d4) #5 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #6 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) Stack trace of thread 9413: #0 0x00007f8e80fb84e9 n/a (libc.so.6 + 0x8f4e9) #1 0x00007f8e80fbb242 pthread_cond_timedwait (libc.so.6 + 0x92242) #2 0x00007f8e695f331c n/a (libnvidia-glcore.so.550.100 + 0x9f331c) #3 0x00007f8e69b08144 n/a (libnvidia-glcore.so.550.100 + 0xf08144) #4 0x00007f8e69af5276 n/a (libnvidia-glcore.so.550.100 + 0xef5276) #5 0x00007f8e695f57d4 n/a (libnvidia-glcore.so.550.100 + 0x9f57d4) #6 0x00007f8e80fbbded n/a (libc.so.6 + 0x92ded) #7 0x00007f8e8103f0dc n/a (libc.so.6 + 0x1160dc) ELF object binary architecture: AMD x86-64 ```
Joshua-Ashton commented 1 month ago

Are you able to get a backtrace with symbols?

sergio-fferreira commented 1 month ago

@Joshua-Ashton Apologies for the delay.

How can I get a backtrace with symbols?

unit73e commented 1 month ago

I have the same problem, using an AMD RX 6600, so it's not nvidia specific.

More information:

I'm trying to backrace with symbols but apparently gamescope build instructions don't seem to work as expected. I don't get a gamescope executable after compiling.

matte-schwartz commented 1 month ago

@unit73e the Gamescope binary gets placed in build/src/ now instead of directly into build/, check in there as well

unit73e commented 1 month ago

@matte-schwartz thanks

Here's what I did:

meson --buildtype=debugoptimized build/
ninja -C build
build/src/gamescope --backend sdl -- vkcube
coredumpctl debug 126914

And finally got this with backtrace:

> gdb backtrace
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007b4d5cbb6463 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007b4d5cb5d120 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007b4d5cb444c3 in __GI_abort () at abort.c:79
#4  0x00007b4d5ce97b2c in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007b4d5ceadffa in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007b4d5ce9752a in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0x00005e2a70270712 in std::__terminate () at /usr/include/c++/14.2.1/x86_64-pc-linux-gnu/bits/c++config.h:324
#8  std::thread::~thread (this=0x5e2a9246e8e0, __in_chrg=<optimized out>) at /usr/include/c++/14.2.1/bits/std_thread.h:182
#9  gamescope::CSDLBackend::~CSDLBackend (this=0x5e2a9246e860, __in_chrg=<optimized out>) at ../src/Backends/SDLBackend.cpp:111
#10 gamescope::CSDLBackend::~CSDLBackend (this=0x5e2a9246e860, __in_chrg=<optimized out>) at ../src/Backends/SDLBackend.cpp:111
#11 0x00005e2a7025ba5a in gamescope::IBackend::Set (pBackend=pBackend@entry=0x0) at ../src/backend.cpp:30
#12 0x00005e2a701f5aec in steamcompmgr_exit () at ../src/steamcompmgr.cpp:5894
#13 0x00005e2a702093c4 in steamcompmgr_main (argc=argc@entry=5, argv=argv@entry=0x7ffe674167c8) at ../src/steamcompmgr.cpp:7758
#14 0x00005e2a70215799 in steamCompMgrThreadRun (argc=5, argv=0x7ffe674167c8) at ../src/main.cpp:995
#15 0x00007b4d5cee1cf4 in std::execute_native_thread_routine (__p=0x5e2a924ad380) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#16 0x00007b4d5cbb439d in start_thread (arg=<optimized out>) at pthread_create.c:447
#17 0x00007b4d5cc3949c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Joshua-Ashton commented 1 month ago

This looks like it's just crashing on shutdown because vkcube didn't open. Do you have vkcube installed?

unit73e commented 1 month ago

@Joshua-Ashton it does open but then again it could be be messing up the backtrace

image

Then I get this after closing vkcube

image

matte-schwartz commented 1 month ago

OP reported that --backend sdl mitigated the issue for them on nvidia, but it looks like the opposite is true for you on amd. may be a different issue?

unit73e commented 1 month ago

@matte-schwartz you're right, it is the opposite problem. Didn't read carefully enough.

With the wayland backend it works perfect for vkcube and friends, except with wine. With wine it gets stuck on exit, that's why I experimented with SDL, and then noticed the core dump. Doesn't really bother me that much except it's filling the disk with logs. I suppose it's a different problem.

This should be reproducible with latest Arch packages.

sergio-fferreira commented 1 month ago

@Joshua-Ashton

I tried to reproduce @unit73e steps and running build/src/gamescope vkcube, here are the results:

Output ``` [gamescope] [Info] console: gamescope version 3.14.29-9-g94271f3 No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. [gamescope] [Info] vulkan: selecting physical device 'NVIDIA GeForce RTX 3060 Laptop GPU': queue family 2 (general queue family 0) [gamescope] [Info] vulkan: physical device supports DRM format modifiers [gamescope] [Info] wlserver: [backend/headless/backend.c:67] Creating headless backend [gamescope] [Info] xdg_backend: Seat name: [gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0) [gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0) [gamescope] [Info] vulkan: supported DRM formats for sampling usage: [gamescope] [Info] vulkan: AR24 (0x34325241) [gamescope] [Info] vulkan: XR24 (0x34325258) [gamescope] [Info] vulkan: AB24 (0x34324241) [gamescope] [Info] vulkan: XB24 (0x34324258) [gamescope] [Info] vulkan: RG16 (0x36314752) [gamescope] [Info] vulkan: NV12 (0x3231564E) [gamescope] [Info] vulkan: AB4H (0x48344241) [gamescope] [Info] vulkan: XB4H (0x48344258) [gamescope] [Info] vulkan: AB30 (0x30334241) [gamescope] [Info] vulkan: XB30 (0x30334258) [gamescope] [Info] vulkan: AR30 (0x30335241) [gamescope] [Info] vulkan: XR30 (0x30335258) [gamescope] [Info] wlserver: Running compositor on wayland display 'gamescope-0' [gamescope] [Info] wlserver: [backend/headless/backend.c:17] Starting headless backend [gamescope] [Info] wlserver: Successfully initialized libei for input emulation! [gamescope] [Error] wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use [gamescope] [Info] wlserver: [xwayland/server.c:107] Starting Xwayland on :2 [gamescope] [Info] pipewire: stream state changed: connecting [gamescope] [Info] pipewire: stream state changed: paused [gamescope] [Info] pipewire: stream available on node ID: 67 [gamescope] [Info] xwm: Embedded, no cursor set. Using left_ptr by default. [gamescope] [Info] vblank: Using timerfd. (EE) failed to read Wayland events: Broken pipe zsh: IOT instruction (core dumped) build/src/gamescope vkcube ```
coredumpctl info 6778 ``` PID: 6778 (gamescope-wl) UID: 1000 (boss) GID: 1000 (boss) Signal: 6 (ABRT) Timestamp: Tue 2024-08-13 10:24:29 WEST (1min 31s ago) Command Line: build/src/gamescope vkcube Executable: /home/boss/Transferências/gamescope/build/src/gamescope Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@9abfa10dc9b8408b9dc10c686d7ad4b0.service Unit: user@1000.service User Unit: app-org.kde.konsole@9abfa10dc9b8408b9dc10c686d7ad4b0.service Slice: user-1000.slice Owner UID: 1000 (boss) Boot ID: 9c2b2c778a5544dfab0caa204c365db7 Machine ID: 5bc000a173eb49d28ba70662d8195179 Hostname: manjaro-laptop Storage: /var/lib/systemd/coredump/core.gamescope-wl.1000.9c2b2c778a5544dfab0caa204c365db7.6778.1723541069000000.zst (present) Size on Disk: 3.5M Message: Process 6778 (gamescope-wl) of user 1000 dumped core. Stack trace of thread 6781: #0 0x00007b2ab10a53f4 n/a (libc.so.6 + 0x963f4) #1 0x00007b2ab104c120 raise (libc.so.6 + 0x3d120) #2 0x00007b2ab10334c3 abort (libc.so.6 + 0x244c3) #3 0x0000612cfd92eadd n/a (/home/boss/Transferências/gamescope/build/src/gamescope + 0x4badd) ELF object binary architecture: AMD x86-64 ```
coredumpctl debug 6778 ``` (gdb) backtrace #0 0x00007b2ab10a53f4 in ?? () from /usr/lib/libc.so.6 #1 0x00007b2ab104c120 in raise () from /usr/lib/libc.so.6 #2 0x00007b2ab10334c3 in abort () from /usr/lib/libc.so.6 #3 0x0000612cfd92eadd in gamescope::CWaylandInputThread::ThreadFunc (this=0x612d31e63900) at ../src/Backends/WaylandBackend.cpp:2353 #4 0x00007b2ab12e1cf4 in std::execute_native_thread_routine (__p=0x612d31e67b30) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104 #5 0x00007b2ab10a339d in ?? () from /usr/lib/libc.so.6 #6 0x00007b2ab112849c in ?? () from /usr/lib/libc.so.6 ```

Don't hesitate to ask further questions.

unit73e commented 1 month ago

@sergio-fferreira just one additional point, you have ?? in your libc.so.6 traces, and that means it doesn't have debug information on glibc (you do have in gamescope). If you want to add that as well GDB asks at start if you want to download debug info. There are other ways, but that's the easiest.

sergio-fferreira commented 1 month ago

@sergio-fferreira just one additional point, you have ?? in your libc.so.6 traces, and that means it doesn't have debug information on glibc (you do have in gamescope). If you want to add that as well GDB asks at start if you want to download debug info. There are other ways, but that's the easiest.

Indeed, I noticed, but didn't know how to solve it. Thank you, I will update the results when possible.

unit73e commented 1 month ago

I also tried in a more traditional way of debugging. I think it should give a better picture of what's happening in my case, because we get two backtraces. These steps can be copied as well for @sergio-fferreira case:

gdb --args build/src/gamescope --backend sdl -- vkcube
(gdb) run
...
Enable debuginfod for this session? (y or [n]) y
...

Then we close the vkcube window and get:

Thread 4 "gamescope-sdl" received signal SIGTERM, Terminated.
[Switching to Thread 0x7fffec2006c0 (LWP 5125)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=15, no_tid=no_tid@entry=0) at pthread_kill.c:44
44       return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0

Then backtrace:

(gdb) backtrace 
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=15, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff73b6463 in __pthread_kill_internal (threadid=<optimized out>, signo=15) at pthread_kill.c:78
#2  0x00007ffff735d120 in __GI_raise (sig=15) at ../sysdeps/posix/raise.c:26
#3  0x000055555564562b in gamescope::CSDLBackend::SDLThreadFunc (this=0x55555593e870) at ../src/Backends/SDLBackend.cpp:763
#4  0x00007ffff76e1cf4 in std::execute_native_thread_routine (__p=0x55555593ba80) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#5  0x00007ffff73b439d in start_thread (arg=<optimized out>) at pthread_create.c:447
#6  0x00007ffff743949c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

In gamescope it's raising a SIGTERM when it detects a window close event:

> awk 'NR>=758 && NR<=765 {print NR ":" $0}' src/Backends/SDLBackend.cpp
758:                case SDL_WINDOWEVENT:
759:                {
760:                    switch( event.window.event )
761:                    {
762:                        case SDL_WINDOWEVENT_CLOSE:
763:                            raise( SIGTERM );
764:                            break;
765:                        default:

And then we can continue and backtrace again:

(gdb) continue 
Continuing.
terminate called without an active exception
[Thread 0x7fffed6006c0 (LWP 5123) exited]

Thread 9 "gamescope-xwm" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffda0006c0 (LWP 5142)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44       return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) backtrace 
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff73b6463 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007ffff735d120 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff73444c3 in __GI_abort () at abort.c:79
#4  0x00007ffff7697b2c in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007ffff76adffa in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007ffff769752a in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0x0000555555646712 in std::__terminate () at /usr/include/c++/14.2.1/x86_64-pc-linux-gnu/bits/c++config.h:324
#8  std::thread::~thread (this=0x55555593e8f0, __in_chrg=<optimized out>) at /usr/include/c++/14.2.1/bits/std_thread.h:182
#9  gamescope::CSDLBackend::~CSDLBackend (this=0x55555593e870, __in_chrg=<optimized out>) at ../src/Backends/SDLBackend.cpp:111
#10 gamescope::CSDLBackend::~CSDLBackend (this=0x55555593e870, __in_chrg=<optimized out>) at ../src/Backends/SDLBackend.cpp:111
#11 0x0000555555631a5a in gamescope::IBackend::Set (pBackend=pBackend@entry=0x0) at ../src/backend.cpp:30
#12 0x00005555555cbaec in steamcompmgr_exit () at ../src/steamcompmgr.cpp:5894
#13 0x00005555555df3c4 in steamcompmgr_main (argc=argc@entry=5, argv=argv@entry=0x7fffffffdbe8) at ../src/steamcompmgr.cpp:7758
#14 0x00005555555eb799 in steamCompMgrThreadRun (argc=5, argv=0x7fffffffdbe8) at ../src/main.cpp:995
#15 0x00007ffff76e1cf4 in std::execute_native_thread_routine (__p=0x55555597be80) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#16 0x00007ffff73b439d in start_thread (arg=<optimized out>) at pthread_create.c:447
#17 0x00007ffff743949c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) continue 
Continuing.
[gamescopereaper] [Info]  reaper: Parent of gamescopereaper was killed. Killing children.
[Thread 0x7fffd96006c0 (LWP 5144) exited]
[Thread 0x7fffda0006c0 (LWP 5142) exited]
[Thread 0x7fffdb4006c0 (LWP 5141) exited]
[Thread 0x7fffdaa006c0 (LWP 5128) exited]
[Thread 0x7fffe8e006c0 (LWP 5126) exited]
[Thread 0x7fffec2006c0 (LWP 5125) exited]
[Thread 0x7fffecc006c0 (LWP 5124) exited]
(EE) failed to read Wayland events: Broken pipe

Program terminated with signal SIGABRT, Aborted.
The program no longer exists.

Here it tries to delete the backend, and then it crashes:

> awk 'NR>=25 && NR<=35 {print NR ":" $0}' src/backend.cpp
25:
26:    bool IBackend::Set( IBackend *pBackend )
27:    {
28:        if ( s_pBackend )
29:        {
30:            delete s_pBackend;
31:            s_pBackend = nullptr;
32:        }
33:
34:        if ( pBackend )
35:        {

If I had to guess gamescope is not handling the SIGTERM of the vkcube thread, and so we get a SIGABRT, and then a core dump, but that's just my guess. Maybe the object doesn't exist anymore and then it crashes? In my case with AMD + SDL and this thread Nvidia + Wayland. I'm a rusty C/C++ tools but I think I could debug with breakpoints to find out. Either that or someone more experienced with gamescope code will figure it out.

EDIT: added code information where relevant

unit73e commented 1 month ago

It's also a good practice to compare with what's not core dumping:

gdb --args build/src/gamescope -- vkcube
(gdb) run
...
Enable debuginfod for this session? (y or [n]) y
...

Close window and:

Thread 13 "gamescope-xwm" received signal SIGTERM, Terminated.
[Switching to Thread 0x7fffdec006c0 (LWP 5345)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=15, no_tid=no_tid@entry=0) at pthread_kill.c:44
44       return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) continue 
Continuing.
[Thread 0x7fffe74006c0 (LWP 5327) exited]
[Thread 0x7fffed6006c0 (LWP 5320) exited]
[Thread 0x7fffec2006c0 (LWP 5322) exited]
[Thread 0x7fffdec006c0 (LWP 5345) exited]
(EE) [gamescopereaper] [Info]  reaper: Parent of gamescopereaper was killed. Killing children.
failed to read Wayland events: Broken pipe
[Gamescope WSI] getWindowRect: xcb_get_geometry failed for window 0x400000.
[Gamescope WSI] getWindowRect: xcb_get_geometry failed for window 0x400000.
[Gamescope WSI] getLargestObscuringWindowSize: xcb_query_tree failed for window 0x400000.
[Gamescope WSI] getToplevelWindow: xcb_query_tree failed for window 0x400000.
[Gamescope WSI] canBypassXWayland: failed to get window info for window 0x400000.
[Gamescope WSI] Creating swapchain for xid: 0x400000 - minImageCount: 4 - format: VK_FORMAT_B8G8R8A8_UNORM - colorspace: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - flip: false
[Gamescope WSI] Refusing to make swapchain (unsupported VkFormat) for xid: 0x400000 - format: VK_FORMAT_B8G8R8A8_UNORM - colorspace: VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - flip: false
[gamescope] [Info]  launch: Primary child shut down!
[Thread 0x7fffde2006c0 (LWP 5347) exited]
[Thread 0x7fffe4a006c0 (LWP 5330) exited]
[Thread 0x7fffecc006c0 (LWP 5321) exited]
[Thread 0x7fffdf6006c0 (LWP 5344) exited]
[Thread 0x7fffe60006c0 (LWP 5329) exited]
[Thread 0x7fffe7e006c0 (LWP 5326) exited]
[Thread 0x7fffe88006c0 (LWP 5325) exited]
[Thread 0x7ffff688eac0 (LWP 5316) exited]
[Thread 0x7fffe6a006c0 (LWP 5328) exited]
[New process 5316]
[Inferior 1 (process 5316) exited normally]
(gdb) backtrace 
No stack.

My bug is not the same but it looks related. I'd say do these steps in your machine @sergio-fferreira , it gives a bit more information than coredumpctl.

I put all the information because I'm aware not everyone is a developer and still want to help.

sharkautarch commented 1 month ago

@unit73e The last backtrace you posted in https://github.com/ValveSoftware/gamescope/issues/1451#issuecomment-2286254969 only happens when gamescope is already closing. It’s been a known issue where gamescope w/ sdl backend coredumps w/ std::terminate being called when you close it: https://github.com/ValveSoftware/gamescope/issues/1305

I had made a pr to fix it, and also fix another segfault on exit that I discovered after fixing the std::terminate issue: https://github.com/ValveSoftware/gamescope/pull/1335 However, matte-shwartz reported that that PR would somehow cause gamescope to segfault when switching from gaming mode to desktop mode, which is worse than the issue the PR tries to fix…

While it is annoying that gamescope sdl is coredumping on exit, to the best of my knowledge, the specific issues causing it to coredump on exit are unrelated to issues w/ gamescope crashing/hanging during runtime. Note that I have heard that gamescope sdl sometimes hangs when running it on a wayland desktop, (especially w/ nvidia gpus). But I don’t think that’s related to the issue that causes gamescope sdl to coredump on exit

sergio-fferreira commented 4 weeks ago

Hi @unit73e, here I tried to reproduce your steps in https://github.com/ValveSoftware/gamescope/issues/1451#issuecomment-2286254969. Please remember my issue is different from yours. My issue is gamescope vkcube immediately crashing when run in a wayland session (I assume using the wayland backend).

Using latest master (commit b768e8f7815b098748fed2de0372abd745f2c672).

gdb --args build/src/gamescope vkcube
...
(gdb) run
Starting program: /home/boss/Transferências/gamescope/build/src/gamescope vkcube
...
Enable debuginfod for this session? (y or [n]) y
...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffed6006c0 (LWP 8097)]
[New Thread 0x7fffecc006c0 (LWP 8098)]
[gamescope] [Info]  console: gamescope version 3.14.29-20-gb768e8f
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
[New Thread 0x7fffec2006c0 (LWP 8099)]
[New Thread 0x7fffe88006c0 (LWP 8101)]
[New Thread 0x7fffe7e006c0 (LWP 8102)]
[New Thread 0x7fffe74006c0 (LWP 8103)]
[New Thread 0x7fffe6a006c0 (LWP 8104)]
[New Thread 0x7fffe60006c0 (LWP 8105)]
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
[New Thread 0x7fffbf2006c0 (LWP 8107)]
[gamescope] [Info]  vulkan: selecting physical device 'NVIDIA GeForce RTX 3060 Laptop GPU': queue family 2 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[New Thread 0x7fffe56006c0 (LWP 8109)]
[New Thread 0x7fffe4c006c0 (LWP 8110)]
[New Thread 0x7fffdde006c0 (LWP 8111)]
[New Thread 0x7fffd12006c0 (LWP 8113)]
[New Thread 0x7fffbe8006c0 (LWP 8116)]
[New Thread 0x7fffbde006c0 (LWP 8117)]
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  xdg_backend: Seat name: 
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)
[gamescope] [Info]  vulkan: supported DRM formats for sampling usage:
[gamescope] [Info]  vulkan:   AR24 (0x34325241)
[gamescope] [Info]  vulkan:   XR24 (0x34325258)
[gamescope] [Info]  vulkan:   AB24 (0x34324241)
[gamescope] [Info]  vulkan:   XB24 (0x34324258)
[gamescope] [Info]  vulkan:   RG16 (0x36314752)
[gamescope] [Info]  vulkan:   NV12 (0x3231564E)
[gamescope] [Info]  vulkan:   AB4H (0x48344241)
[gamescope] [Info]  vulkan:   XB4H (0x48344258)
[gamescope] [Info]  vulkan:   AB30 (0x30334241)
[gamescope] [Info]  vulkan:   XB30 (0x30334258)
[gamescope] [Info]  vulkan:   AR30 (0x30335241)
[gamescope] [Info]  vulkan:   XR30 (0x30335258)
[gamescope] [Info]  wlserver: Using explicit sync when available
[gamescope] [Info]  wlserver: Running compositor on wayland display 'gamescope-0'
[gamescope] [Info]  wlserver: [backend/headless/backend.c:17] Starting headless backend
[gamescope] [Info]  wlserver: Successfully initialized libei for input emulation!
[gamescope] [Error] wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use
[Detaching after fork from child process 8118]
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :2
[gamescope] [Info]  pipewire: stream state changed: connecting
[gamescope] [Info]  pipewire: stream state changed: paused
[gamescope] [Info]  pipewire: stream available on node ID: 71
[New Thread 0x7fffbd4006c0 (LWP 8122)]
[New Thread 0x7fffbca006c0 (LWP 8123)]
[gamescope] [Info]  xwm: Embedded, no cursor set. Using left_ptr by default.
[gamescope] [Info]  vblank: Using timerfd.

Thread 4 "gamescope" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffec2006c0 (LWP 8099)]
0x00007ffff73b63f4 in ?? () from /usr/lib/libc.so.6
(gdb) backtrace
#0  0x00007ffff73b63f4 in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff735d120 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff73444c3 in abort () from /usr/lib/libc.so.6
#3  0x00005555555a009d in gamescope::CWaylandInputThread::ThreadFunc (this=0x55555593a910) at ../src/Backends/WaylandBackend.cpp:2348
#4  0x00007ffff76e1cf4 in std::execute_native_thread_routine (__p=0x55555593eb40) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#5  0x00007ffff73b439d in ?? () from /usr/lib/libc.so.6
#6  0x00007ffff743949c in ?? () from /usr/lib/libc.so.6
(gdb) continue
Continuing.
Couldn't get registers: Processo inexistente.
(gdb) [Thread 0x7fffbca006c0 (LWP 8123) exited]
[Thread 0x7fffbde006c0 (LWP 8117) exited]
[Thread 0x7fffbe8006c0 (LWP 8116) exited]
[Thread 0x7fffd12006c0 (LWP 8113) exited]
[Thread 0x7fffdde006c0 (LWP 8111) exited]
[Thread 0x7fffe4c006c0 (LWP 8110) exited]
[Thread 0x7fffe56006c0 (LWP 8109) exited]
[Thread 0x7fffbf2006c0 (LWP 8107) exited]
[Thread 0x7fffe60006c0 (LWP 8105) exited]
[Thread 0x7fffe6a006c0 (LWP 8104) exited]
[Thread 0x7fffe74006c0 (LWP 8103) exited]
[Thread 0x7fffe7e006c0 (LWP 8102) exited]
[Thread 0x7fffe88006c0 (LWP 8101) exited]
[Thread 0x7fffec2006c0 (LWP 8099) exited]
[Thread 0x7fffecc006c0 (LWP 8098) exited]
[Thread 0x7fffed6006c0 (LWP 8097) exited]
[Thread 0x7ffff6894ac0 (LWP 8094) exited]
(EE) failed to read Wayland events: Broken pipe
[Thread 0x7fffbd4006c0 (LWP 8122) exited]
[New process 8094]

Program terminated with signal SIGABRT, Aborted.
The program no longer exists.

The program is not being run.

I don't know why "??" are still appearing...

Then isolating where the abort() is called:

> awk 'NR>=2340 && NR<=2355 {print NR ":" $0}' src/Backends/WaylandBackend.cpp                                                                                 
2340:        m_bInitted.wait( false );
2341:
2342:        if ( !m_Waiter.IsRunning() )
2343:            return;
2344:
2345:        int nFD = wl_display_get_fd( m_pBackend->GetDisplay() );
2346:        if ( nFD < 0 )
2347:        {
2348:            abort();
2349:        }
2350:
2351:        CFunctionWaitable waitable( nFD );
2352:        m_Waiter.AddWaitable( &waitable );
2353:
2354:        int nRet = 0;
2355:        while ( m_Waiter.IsRunning() )

With this, and by reading documentation, I believe that gamescope crashes when it can't obtain a display context's file descriptor.

Thank you @unit73e for your instructions, I hope the issue is more clear now.

layercak3 commented 4 weeks ago

That abort after wl_display_get_fd was also reported in https://github.com/ValveSoftware/gamescope/issues/1456. I have never run into that abort on the first time the gamescope window opens, on amdgpu/sway. I can only reproduce when it is the second/etc. time the gamescope window opens (for the same gamescope process).

sergio-fferreira commented 3 weeks ago

The line

[gamescope] [Error] wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use

also seems important.

sharkautarch commented 3 weeks ago

@sergio-fferreira

[gamescope] [Error] wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use

Actually that’s pretty much benign Usually that means that there’s already an Xwayland server on :0.0 or :1.0 I think I’ve seen that message plenty of times when running gamescope without any issues

sergio-fferreira commented 3 weeks ago

Alright, sorry. It is not related, then.