Bug 461989 - Stop job for kwin_x11 takes a long time with version 525.53 of the NVIDIA drivers
Summary: Stop job for kwin_x11 takes a long time with version 525.53 of the NVIDIA dri...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.26.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-18 12:22 UTC by Jay Griffin
Modified: 2024-08-30 16:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Griffin 2022-11-18 12:22:57 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

Persistent stop job when shutting down system or rebooting for plasma-kwin_x11,service

STEPS TO REPRODUCE
1.  Use system for prolonged period and shutdown/restart

OBSERVED RESULT

stop job on shutdown/restart
EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION

When using my system for most of the day, running wine apps, browsers media players etc when i reboot or shutdown i get a stob job delay. Just reporting because I read there was a bug with this previously that appears to have been resolved but this is new behaviour that started happening recently after a system update so Im not sure.

here is log from when i booted up and shutdown last night:

Nov 17 20:50:45 arch kwin_x11[913]: kwin_xkbcommon: XKB: inet:323:58: unrecognized keysym "XF86EmojiPicker"
Nov 17 20:50:45 arch kwin_x11[913]: kwin_xkbcommon: XKB: inet:324:58: unrecognized keysym "XF86Dictate"
Nov 17 20:50:46 arch kwin_x11[913]: OpenGL vendor string:                   NVIDIA Corporation
Nov 17 20:50:46 arch kwin_x11[913]: OpenGL renderer string:                 NVIDIA GeForce RTX 2060/PCIe/SSE2
Nov 17 20:50:46 arch kwin_x11[913]: OpenGL version string:                  3.1.0 NVIDIA 525.53
Nov 17 20:50:46 arch kwin_x11[913]: OpenGL shading language version string: 1.40 NVIDIA via Cg compiler
Nov 17 20:50:46 arch kwin_x11[913]: Driver:                                 NVIDIA
Nov 17 20:50:46 arch kwin_x11[913]: Driver version:                         525.53
Nov 17 20:50:46 arch kwin_x11[913]: GPU class:                              Unknown
Nov 17 20:50:46 arch kwin_x11[913]: OpenGL version:                         3.1
Nov 17 20:50:46 arch kwin_x11[913]: GLSL version:                           1.40
Nov 17 20:50:46 arch kwin_x11[913]: X server version:                       1.21.1
Nov 17 20:50:46 arch kwin_x11[913]: Linux kernel version:                   6.0.8
Nov 17 20:50:46 arch kwin_x11[913]: Requires strict binding:                no
Nov 17 20:50:46 arch kwin_x11[913]: GLSL shaders:                           yes
Nov 17 20:50:46 arch kwin_x11[913]: Texture NPOT support:                   yes
Nov 17 20:50:46 arch kwin_x11[913]: Virtual Machine:                        no
Nov 17 21:00:26 arch kwin_x11[913]: kwin_core: XCB error: 152 (BadDamage), sequence: 64146, resource id: 16803168, major code: 143 (DAMAGE), minor code: 3 (Subtract)
Nov 17 21:18:57 arch kwin_x11[913]: kwin_core: XCB error: 3 (BadWindow), sequence: 17955, resource id: 146800651, major code: 129 (SHAPE), minor code: 6 (Input)
Nov 17 21:23:12 arch kwin_x11[913]: kwin_core: XCB error: 3 (BadWindow), sequence: 53763, resource id: 146800654, major code: 129 (SHAPE), minor code: 6 (Input)
Nov 17 21:23:34 arch kwin_x11[913]: kwin_core: XCB error: 3 (BadWindow), sequence: 3379, resource id: 146800657, major code: 129 (SHAPE), minor code: 6 (Input)
Nov 17 21:23:43 arch kwin_x11[913]: kwin_core: XCB error: 3 (BadWindow), sequence: 12017, resource id: 146800660, major code: 129 (SHAPE), minor code: 6 (Input)
Nov 17 23:47:02 arch kwin_x11[913]: kwin_core: XCB error: 152 (BadDamage), sequence: 5650, resource id: 17674881, major code: 143 (DAMAGE), minor code: 3 (Subtract)
Nov 17 23:47:10 arch kwin_x11[913]: kwin_core: XCB error: 152 (BadDamage), sequence: 12349, resource id: 17675860, major code: 143 (DAMAGE), minor code: 3 (Subtract)
Nov 18 00:12:07 arch kwin_x11[913]: kwin_core: XCB error: 152 (BadDamage), sequence: 27006, resource id: 17824762, major code: 143 (DAMAGE), minor code: 3 (Subtract)
Nov 18 00:54:51 arch kwin_x11[913]: kwin_core: XCB error: 3 (BadWindow), sequence: 28770, resource id: 146800669, major code: 129 (SHAPE), minor code: 6 (Input)
Nov 18 02:28:08 arch kwin_x11[913]: kwin_core: XCB error: 152 (BadDamage), sequence: 56063, resource id: 18597348, major code: 143 (DAMAGE), minor code: 3 (Subtract)
Nov 18 02:28:14 arch kwin_x11[913]: kwin_core: Failed to focus 0x1c00011 (error 3)
Nov 18 02:28:14 arch kwin_x11[913]: kwin_core: Failed to focus 0x1c00017 (error 3)
Nov 18 02:28:14 arch kwin_x11[913]: kwin_core: Failed to focus 0x1c00017 (error 3)
Nov 18 02:28:17 arch kwin_x11[913]: The X11 connection broke: I/O error (code 1)
Nov 18 02:28:17 arch kwin_x11[913]: XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
Nov 18 02:28:17 arch kwin_x11[913]:       after 55 requests (55 known processed) with 0 events remaining.
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: State 'stop-sigterm' timed out. Killing.
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: Killing process 913 (kwin_x11) with signal SIGKILL.
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: Killing process 1004 (QQmlThread) with signal SIGKILL.
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: Main process exited, code=killed, status=9/KILL
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: Failed with result 'timeout'.
Nov 18 02:29:48 arch systemd[770]: plasma-kwin_x11.service: Consumed 16min 38.807s CPU time.
Comment 1 Jay Griffin 2022-12-01 15:39:23 UTC
After I reported this is tried a couple of things:

I downgraded my nvidia drivers from 525.53 to 5.20.56.56 and changed sddm from the official arch repos (0.19.0-9) to sddm-git (0.19.0.170.g3e48649-1) from the aur as this was a suggestion I found on an old bug report describing the same issue. 

This actually appeared to provide some difference in the problem as I had a good number of days where the stop job issue with kwin happened only one time which was directly after rebooting when I changed the sddm package to the version above. It did not occur again after that. 

Today I have upgraded the nvidia package again to 525.60.11 in-line with the Arch package repos and the issue happens on every reboot/shutdown. Notably, when I first installed plasma on this machine I was using nvidia driver version 515.x and I did not experience this problem at all then, there was a correlation with changing to a newer nvidia driver version when I started to experience this issue. 

I cannot confirm if this nvidia driver is the source of the problem but perhaps this information is useful to you.
Comment 2 Paidhi 2022-12-10 08:54:30 UTC
I also have this issue.
OS: OpenSUSE Tumbleweed
Nvidia driver: 515.86.01
KDE Plasma: 5.26.4
Graphics Platform: X11

There is a rather simple workaround:
Instead of "Restart" in the active Plasma session first use "Log Out" and then pick "Restart" on the SDDM login screen.
Comment 3 Szollosi-Nagy Balint 2024-08-30 07:09:08 UTC
TLDR: there is a solution, and it is released in Plasma 6, and you can patch Plasma 5 if you need to.

Until recently I had the same problem in Debian 12 Bookworm, and I even upgraded to unstable Trixie in hopes that a new KDE version will solve it. But it didn't.

The issue itself looked very much like a "wind-down" problem: maybe some components are shut down, while others are still working. 
Searching along these lines I found this:
"https://discuss.kde.org/t/weird-crashes-when-logging-out/5927"
Which linked to 
"https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3302"


There the author found that SystemD was restarting some of the components that Kwin was shutting down, hence the issue.
Our issue seemed very similar.

Original commit to use systemd for coordinating the shutdown, instead of killing Kwin, while systemd keeps re-launching some of the killed components:
https://github.com/KDE/plasma-workspace/commit/6ce8f434139f47e6a71bf0b68beae92be8845ce4

The commit that refines the above solution to also handle legacy boot, where systemd is disabled for some reason by the user.
https://github.com/KDE/plasma-workspace/commit/41629e86035e341bb4dea662236aefdc274e7c30


This is released in Plasma 6, so if you can upgrade, then your problem will be solved.

Not sure I understand its status in Plasma 5, but I have patched my Debian 12 Bookworm that has plasma-workspace-5.27.5,
and it corrects this shutdown delay issue.


Dear KDE team, can we get these two commits released for the Plasma-workspace 5 series too, as a bugfix?

It concerns the package plasma-workspace, and affects two files only.

It solves this bug report (and many others listed in the commit message), and would improve the user experience 
for Debian too (for the moment the new unstable Debian Trixie also uses Plasma 5 (with plasma-workspace-5.27.11.1))

Related open bugs 453928, 461989
The two commits addressed these bugs 473824, 409088, 450531, 451939, 450320, 434403
and bug 483066
Comment 4 Szollosi-Nagy Balint 2024-08-30 07:20:20 UTC
Changing status to Confirmed, as I could reproduce it in Debian 12 Boorkworm stable.
Comment 5 Nate Graham 2024-08-30 16:07:27 UTC
Marking as fixed in Plasma 6; it'll be up to KWin folks regarding whether not a backport is feasible.