Bug 497687 - kwin_x11 hangs or crashes on shutdown/reboot
Summary: kwin_x11 hangs or crashes on shutdown/reboot
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-x11-standalone (other bugs)
Version First Reported In: 6.2.4
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: X11-only
Depends on:
Blocks:
 
Reported: 2024-12-19 16:50 UTC by Miro
Modified: 2025-02-24 17:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Hang callstack (3.30 KB, text/plain)
2024-12-19 16:50 UTC, Miro
Details
Journal of kwin_x11 when the hang occurred. (20.41 KB, text/plain)
2024-12-19 16:53 UTC, Miro
Details
Journal of kwin_x11 when the crash occurred. (11.16 KB, text/plain)
2024-12-19 16:53 UTC, Miro
Details
Crash callstack. (12.55 KB, text/plain)
2024-12-19 23:44 UTC, Miro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miro 2024-12-19 16:50:33 UTC
Created attachment 176769 [details]
Hang callstack

SUMMARY
kwin_x11 frequently hangs on shutdown/reboot causing a delay and this message to appear: "User job plasma-kwin_x11.service/stop running (XYs / 1min 29s)"

It appears to not terminate after being sent SIGTERM and has to be SIGKILL-ed later. The hang callstack is attached. The thread "vsync event monitor" seems to be stuck deallocating a thread-local GLX resource. The main thread is also waiting for something, probably related to the vsync thread.

If kwin doesn't hang, it crashes immediately with SIGSEGV. Unfortunately, I was not able to get the crash callstack as systemd-coredump does not seem to work during shutdown and nothing shows up in coredumpctl.

STEPS TO REPRODUCE
1. Shutdown or restart.

OBSERVED RESULT
Shutdown gets delayed due to kwin hanging.

EXPECTED RESULT
No delays.

SOFTWARE/OS VERSIONS
OS: Debian Testing
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Kernel Version: 6.11.10-amd64 (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3070/PCIe/SSE2
Graphics Drivers: Proprietary nvidia-driver 565.77

Setting KWIN_X11_FORCE_SOFTWARE_VSYNC=1 fixes both the hang and the crash. I think this prevents the existence of the vsync thread.

This issue seems to be similar to https://bugs.kde.org/show_bug.cgi?id=453928 in terms of symptoms but could have a different root cause.
Comment 1 Miro 2024-12-19 16:53:13 UTC
Created attachment 176770 [details]
Journal of kwin_x11 when the hang occurred.
Comment 2 Miro 2024-12-19 16:53:39 UTC
Created attachment 176771 [details]
Journal of kwin_x11 when the crash occurred.
Comment 3 Miro 2024-12-19 23:44:27 UTC
Created attachment 176776 [details]
Crash callstack.

> Unfortunately, I was not able to get the crash callstack as systemd-coredump does not seem to work during shutdown and nothing shows up in coredumpctl.

This is a known issue: https://github.com/systemd/systemd/issues/28338

Anyway, I was able to work around it by restoring the legacy coredump handling per https://systemd.io/COREDUMP/#restoring-legacy-coredump-handling and managed to acquire the crash callstack.
Comment 4 TraceyC 2025-02-24 17:58:53 UTC
Adding the x11-only keyword