ZaWertun / fedora-copr-kde5

https://copr.fedorainfracloud.org/coprs/zawertun/kde/
18 stars 4 forks source link

KDE does not properly log out, possibly due to klauncher crashing on logout #50

Open DarkWav opened 3 years ago

DarkWav commented 3 years ago

Logout doesn't work properly on my system any more, a black screen with only the cursor remains. I found that after some reboots, klauncher always seems to crash when logging out. I'm running Plasma 5.20, kwin-lowlatency, proprietary NVIDIA drivers and latest Fedora 33 with all testing updates installed.

In the .xsession-errors file, the following appears:

klauncher: Exiting on signal 15
XIO:  fatal IO error 4 on X server ":0"
      after 130185 requests (130185 known processed) with 0 events remaining.
Application::crashHandler() called with signal 11; recent crashes: 1
malloc_consolidate(): unaligned fastbin chunk detected
XIO:  fatal IO error 9 (Invalid file descriptor) on X server ":0"
      after 25 requests (25 known processed) with 0 events remaining.
KCrash: Application '<unknown>' crashing...

Running qdbus org.kde.ksmserver /KSMServer logout 0 0 0 Does not help, I end up with a black screen and only cursor there. However: Running loginctl terminate-user $USER Does make KDE exit correctly. I put this command in a logout script and it successfully works around the issue, logout is relieable now. Do you think the logout freeze might have to do with this klauncher freeze or is it related to something else?

pizzadude commented 3 years ago

I don't have this issue (or maybe it's because I don't log out much) , but maybe it's because of this update? https://bodhi.fedoraproject.org/updates/FEDORA-2020-f5be904258

See https://bugzilla.redhat.com/show_bug.cgi?id=1861700#c136

ZaWertun commented 3 years ago

I don't have this issue (or maybe it's because I don't log out much) , but maybe it's because of this update? https://bodhi.fedoraproject.org/updates/FEDORA-2020-f5be904258

See https://bugzilla.redhat.com/show_bug.cgi?id=1861700#c136

Maybe you're right. I'll try to install this update.

ZaWertun commented 3 years ago

Yep, I see same crash after updating to kde-settings-33.0-2.fc33.

ZaWertun commented 3 years ago

Just downgraded back to the kde-settings-33.0-1.fc33 and I can still see this error after logout. It's something else. Too bad we can't see what process is crashing.

ZaWertun commented 3 years ago

After switch to normal kwin (from kwin-lowlatency) I've got this errors:

Application::crashHandler() called with signal 11; recent crashes: 1
malloc_consolidate(): unaligned fastbin chunk detected
KCrash: Application 'kwin_x11' crashing...
KCrash: Attempting to start /usr/libexec/drkonqi
X connection to :0 broken (explicit kill or server shutdown).

So kwin is crashing after logout.

ZaWertun commented 3 years ago

Logout doesn't work properly on my system any more, a black screen with only the cursor remains. I found that after some reboots, klauncher always seems to crash when logging out. I'm running Plasma 5.20, kwin-lowlatency, proprietary NVIDIA drivers and latest Fedora 33 with all testing updates installed.

In the .xsession-errors file, the following appears:

klauncher: Exiting on signal 15
XIO:  fatal IO error 4 on X server ":0"
      after 130185 requests (130185 known processed) with 0 events remaining.
Application::crashHandler() called with signal 11; recent crashes: 1
malloc_consolidate(): unaligned fastbin chunk detected
XIO:  fatal IO error 9 (Invalid file descriptor) on X server ":0"
      after 25 requests (25 known processed) with 0 events remaining.
KCrash: Application '<unknown>' crashing...

Running qdbus org.kde.ksmserver /KSMServer logout 0 0 0 Does not help, I end up with a black screen and only cursor there. However: Running loginctl terminate-user $USER Does make KDE exit correctly. I put this command in a logout script and it successfully works around the issue, logout is relieable now. Do you think the logout freeze might have to do with this klauncher freeze or is it related to something else?

Try to create script at path /etc/xdg/plasma-workspace/shutdown/98-kill-kwin.sh with following content:

#!/usr/bin/sh

killall kwin_x11

And don't forget to do chmod +x /etc/xdg/plasma-workspace/shutdown/98-kill-kwin.sh afterwards. I see no crashes now, after writing this script. Content of ~/.xsession-errors from last logout:

klauncher: Exiting on signal 1
startkde: Starting up...
startkde: Shutting down...
startkde: Done.
X connection to :0 broken (explicit kill or server shutdown).
XIO:  fatal IO error 9 (Неправильный дескриптор файла) on X server ":0"
      after 25 requests (25 known processed) with 0 events remaining.
ZaWertun commented 3 years ago

Modified script to kill kwin only in current session:

#!/usr/bin/sh
for pid in $(pgrep -u "$USER" kwin_x11); do
  sid=$(cat /proc/"$pid"/sessionid)
  if [ "$sid" = "$XDG_SESSION_ID" ]; then
    kill "$pid"
  fi
done
DarkWav commented 3 years ago

Thanks for the reply. I tried to add the script, and the system still does not log out correctly and the error still gets printed to the .xsession-errors file. Though this time the KDE wallpaper and Panel still remain on the screen visually, but can't be interacted with, CTRL+ALT+DEL also doesn't give any response. However, when switching to a TTY and looking at the running processes, kwin_x11 is definitely terminated and not running any more. I tried both with stock kwin and kwin-lowlatency, same result. However, the actual logout lockup seems very inconsistent. After installing any kwin update it seems to be gone for a few reboots, then re-appears. The weird thing about this lockup is that if I check which processes of my user are still running in htop in a TTY, there are still plenty of them, almost seeming like KDE completely fails to terminate a dozen of processes on logout. I can't reprodue this behavoir on Arch or openSUSE, however since these two use a fundamentally different dbus architecture this isn't a good indicator. These reports seem similar to my issue: https://bugzilla.redhat.com/show_bug.cgi?id=1583793 https://github.com/sddm/sddm/issues/1034 https://forums.fedoraforum.org/showthread.php?320041-Fedora-28-KDE-SDDM https://askbot.fedoraproject.org/en/question/133357/fedora-29plasmakde-hangs-on-logout/ Some of them suggest that the proprietary NVIDIA Driver might be an issue, I'll try what happens with nouveau next.

ZaWertun commented 3 years ago

Thanks for the reply. I tried to add the script, and the system still does not log out correctly and the error still gets printed to the .xsession-errors file. Though this time the KDE wallpaper and Panel still remain on the screen visually, but can't be interacted with, CTRL+ALT+DEL also doesn't give any response. However, when switching to a TTY and looking at the running processes, kwin_x11 is definitely terminated and not running any more. I tried both with stock kwin and kwin-lowlatency, same result. However, the actual logout lockup seems very inconsistent. After installing any kwin update it seems to be gone for a few reboots, then re-appears. The weird thing about this lockup is that if I check which processes of my user are still running in htop in a TTY, there are still plenty of them, almost seeming like KDE completely fails to terminate a dozen of processes on logout. I can't reprodue this behavoir on Arch or openSUSE, however since these two use a fundamentally different dbus architecture this isn't a good indicator. These reports seem similar to my issue: https://bugzilla.redhat.com/show_bug.cgi?id=1583793 sddm/sddm#1034 https://forums.fedoraforum.org/showthread.php?320041-Fedora-28-KDE-SDDM https://askbot.fedoraproject.org/en/question/133357/fedora-29plasmakde-hangs-on-logout/ Some of them suggest that the proprietary NVIDIA Driver might be an issue, I'll try what happens with nouveau next.

Can you test this bug on new user? Also check output of journalctl for errors after logout.

Main problem here - this bug is hard to reproduce. I have the same components / version - and all works fine.

DarkWav commented 3 years ago

Thanks for the reply. A new user does work at first, but after some reboots it freezes, too. Sometimes it starts working again on my primary user.... I should also note that this is not GPU driver related and happens with nouveau as well.

Main problem here - this bug is hard to reproduce.

This is very much true. I got now Idea how to debug properly in this case, I could try to run startplasma_x11 in GDB at some point, but I'm currently too busy in my real life for hour-long debug session. I noticed that there are many scripts in /etc/xdg/plasma-workspace/shutdown, (like a dbus restarting script, ect.) I'll try to remove some of them next as they don't seem to exist on Arch and openSUSE and might be the cause of the issue

ZaWertun commented 3 years ago

dc04f025165728f92bf9b8f3b21a1b5b2ff68c38 and new build of kf5-kglobalaccel should probably fix this issue.

architectlin commented 3 years ago

so with me the problem persists

luminoso commented 3 years ago

You can test having your session services managed by systemd.

Starting on plasma 5.21 you can activate this setting:

kwriteconfig5 --file startkderc --group General --key systemdBoot true

which can potentially help on your issue