Bug 2168034 - kwin_wayland often crashed when used as the sddm Wayland compositor and logging out of Plasma resulting in a black screen
Summary: kwin_wayland often crashed when used as the sddm Wayland compositor and loggi...
Alias: None
Product: Fedora
Classification: Fedora
Component: kwin
Version: 38
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
Whiteboard: AcceptedBlocker
: 2172533 (view as bug list)
Depends On:
Blocks: F38BetaBlocker
TreeView+ depends on / blocked
Reported: 2023-02-08 04:49 UTC by Matt Fagnani
Modified: 2023-02-24 01:08 UTC (History)
11 users (show)

Fixed In Version: kwin-5.27.1-2.fc38
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2023-02-23 21:10:19 UTC
Type: Bug

Attachments (Terms of Use)
Full trace of all threads of kwin_wayland crash when logging out of Plasma as sddm Wayland compositor (27.21 KB, text/plain)
2023-02-08 04:49 UTC, Matt Fagnani
no flags Details

System ID Private Priority Status Summary Last Updated
KDE Software Compilation 465456 0 NOR UNCONFIRMED kwin_wayland often crashed when used as the sddm Wayland compositor and logging out of Plasma resulting in a black scree... 2023-02-08 04:49:51 UTC

Description Matt Fagnani 2023-02-08 04:49:51 UTC
Created attachment 1942812 [details]
Full trace of all threads of kwin_wayland crash when logging out of Plasma as sddm Wayland compositor

Description of problem:

I started Plasma 5.26.90 on Wayland in GNOME Boxes QEMU/KVM VMs using the Fedora Rawhide live image Fedora-KDE-Live-x86_64-Rawhide-20230207.n.0.iso (and earlier) with 3D acceleration disabled using the llvmpipe mesa driver from mesa 22.3.3 (or 3D acceleration enabled using the virgl mesa driver). I disabled automatic login from sddm in System Settings. I logged out from the Application Launcher menu. kwin_wayland often crashed when used as the sddm Wayland compositor when logging out resulting in a black screen with a flashing text cursor appearing instead of sddm. The crashes occurred in KWin::Workspace::geometry and might've been null pointer dereferences since this=0x0.

Core was generated by `/usr/bin/kwin_wayland --no-lockscreen --inputmethod maliit-keyboard --locale1'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  KWin::Workspace::geometry (this=0x0) at /usr/src/debug/kwin-5.26.90-1.fc38.x86_64/src/workspace.cpp:2671
2671        return m_geometry;
[Current thread is 1 (Thread 0x7f250aaaae40 (LWP 3986))]

(gdb) bt
#0  KWin::Workspace::geometry (this=0x0) at /usr/src/debug/kwin-5.26.90-1.fc38.x86_64/src/workspace.cpp:2671
#1  0x00007f250b5c4f61 in KWin::LibInput::Connection::processEvents (this=0x55ed1ebd4000)
    at /usr/src/debug/kwin-5.26.90-1.fc38.x86_64/src/backends/libinput/connection.cpp:376
#2  0x00007f2509adefdb in QObject::event (this=0x55ed1ebc0fd0, e=0x7f24e40056d0) at kernel/qobject.cpp:1347
#3  0x00007f2508faece5 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55ed1ebc0fd0, 
    e=0x7f24e40056d0) at kernel/qapplication.cpp:3640
#4  0x00007f2509ab35e8 in QCoreApplication::notifyInternal2 (receiver=0x55ed1ebc0fd0, event=0x7f24e40056d0)
    at kernel/qcoreapplication.cpp:1064
#5  0x00007f2509ab6a95 in QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, 
    event_type=event_type@entry=0, data=data@entry=0x55ed1eb2abc0) at kernel/qcoreapplication.cpp:1821
#6  0x00007f2509b03311 in QEventDispatcherUNIX::processEvents (this=0x55ed1eb2d940, flags=...)
    at kernel/qeventdispatcher_unix.cpp:468
#7  0x000055ed1e4a0041 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#8  0x00007f2509ab1fbb in QEventLoop::exec (this=this@entry=0x7ffc15e20460, flags=..., flags@entry=...)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#9  0x00007f2509aba23b in QCoreApplication::exec ()
    at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#10 0x00007f2509f5f5bd in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#11 0x00007f2508faec59 in QApplication::exec () at kernel/qapplication.cpp:2832
#12 0x000055ed1e3bcc24 in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/kwin-5.26.90-1.fc38.x86_64/src/main_wayland.cpp:628

I'm attaching the full trace of all threads. This problem seemed to start after the update to sddm-0.19.0^git20230201.3ee57e9-2.fc38 https://koji.fedoraproject.org/koji/buildinfo?buildID=2145291 which fixed a problem where logging out of Plasma on Wayland to sddm on Wayland would show a text login instead of sddm https://bugzilla.redhat.com/show_bug.cgi?id=2110801 That problem might have been masking this one. 

This problem happened most of the times I logged out of Plasma to sddm in recent Fedora Rawhide KDE Plasma VMs. sddm occasionally appeared with a different looking theme where the user icon and password box were at the right side of the screen and the Desktop selection and options to reboot and shutdown were in a bar at the top of the screen.

kwin_wayland sometimes crashed 1-10 times when Plasma started in similar VMs with the same type of trace. Plasma appeared in such cases unless kwin_wayland crashed 10 times and systemd stopped trying to start kwin_wayland.

This type of crash didn't seem to happen on bare metal with on a laptop with an AMD A10-9620P CPU and an integrated AMD Radeon R5 GPU using the radeonsi mesa driver and amdgpu kernel driver. The problem might be specific to running in VMs

Version-Release number of selected component (if applicable):

How reproducible:
kwin_wayland crashed often when used as the sddm Wayland compositor and logging out of Plasma in Rawhide VMs from the last week or so.

Steps to Reproduce:
1. Boot a Fedora 37 KDE Plasma installation updated to 2023-2-7 with updates-testing enabled
2. Log in to Plasma on Wayland
3. Download Fedora-KDE-Live-x86_64-Rawhide-20230207.n.0.iso from https://koji.fedoraproject.org/koji/buildinfo?buildID=2147622 
4. Install GNOME Boxes if it isn't already with sudo dnf install gnome-boxes
5. Start GNOME Boxes
6. boot the Fedora Rawhide live image Fedora-KDE-Live-x86_64-Rawhide-20230207.n.0.iso in a GNOME Boxes QEMU/KVM VM with 3D acceleration disabled using the llvmpipe driver, EFI enabled, and 3 GB RAM
7. Start System Settings in Plasma 5.26.90 on Wayland
8. Click Startup and Shutdown in the menu on the left of System Settings
9. Click Behavior in the Startup and Shutdown > Login Screen (SDDM) screen
10. Remove the check mark for Automatically log in
11. Click Apply
12. Close System Settings
13. Click the Application Launcher menu button at the bottom left of the screen
14. Click the Leave button in the Application Launcher menu
15. Click Log out
16. Select OK to Log out
17. If the kwin_wayland crash didn't happen, log in to Plasma and log out as above until it does

Actual results:
kwin_wayland often crashed when used as the sddm Wayland compositor and logging out of Plasma resulting in a black screen

Expected results:
kwin_wayland wouldn't crash and sddm would appear normally every time.

Additional info:

I reported this problem at https://bugs.kde.org/show_bug.cgi?id=465456

When booting the Fedora Rawhide live image Fedora-KDE-Live-x86_64-Rawhide-20230202.n.0.iso with mesa-23.0.0~rc4-1.fc38 in a GNOME Boxes QEMU/KVM VM with 3D acceleration disabled using the llvmpipe driver, kwin_wayland crashed 10 times in a row as at https://bugzilla.redhat.com/show_bug.cgi?id=2164667 and https://bugs.kde.org/show_bug.cgi?id=465284 I ran startx & from another VT. Plasma on X ran normally. I disabled automatic login from sddm in System Settings and logged out. kwin_wayland on Wayland as the sddm compositor crashed with the type of trace at https://bugzilla.redhat.com/show_bug.cgi?id=2164667 after logging out. The black screen problem with the flashing text cursor at the top left happened. mesa-23.0.0~rc4-1.fc38 was untagged from Rawhide due to this problem https://pagure.io/releng/issue/11247 so later images might have mesa-22.3.3-3.fc38 and so would have kwin_wayland crashes in KWin::Workspace::geometry.

kwin_wayland crashes with similar traces were reported at https://bugzilla.redhat.com/show_bug.cgi?id=2094671 and https://bugzilla.redhat.com/show_bug.cgi?id=2133796

Comment 1 Fedora Blocker Bugs Application 2023-02-09 18:41:31 UTC
Proposed as a Blocker and Freeze Exception for 38-beta by Fedora user mattf using the blocker tracking app because:

 Since a black screen occurred most of the time when logging out of Plasma and occasionally when Plasma started due to these kwin_wayland crashes in QEMU/KVM VMs, the following F38 Beta Blocker criterion might be violated.
Shutting down, rebooting, logging in and logging out must work using standard console commands and the mechanisms offered (if any) by all release-blocking desktops. 

Comment 2 Ben Cotton 2023-02-17 19:49:11 UTC
The KDE SIG has expressed some hope that kwin 5.27 (now in the repo) fixes this. Does the problem still exist after updating?

Comment 3 Matt Fagnani 2023-02-17 20:20:09 UTC
Yes, kwin_wayland still crashes in the same way sometimes when logging out and logging in with Plasma 5.27.0 resulting in a black screen. My report upstream doesn't have any comment so I wouldn't expect the problem to be fixed. https://bugs.kde.org/show_bug.cgi?id=465456

sddm with kwin_wayland as the Wayland compositor only tries to start kwin_wayland once and if it crashes then the black screen occurs. I think this is because kwin_wayland is called directly by CompositorCommand=kwin_wayland --no-lockscreen --inputmethod maliit-keyboard --locale1 in /usr/lib/sddm/sddm.conf.d/plasma-wayland.conf When Plasma starts plasma-kwin_wayland.service is started and if kwin_wayland crashes, then systemd tries to reload kwin_wayland up to 10 times in total. Due to this difference, the black screen problem is more common with sddm using kwin_wayland than with Plasma starting. If sddm were changed to create an equivalent service like sddm-kwin_wayland.service that ran kwin_wayland which /usr/lib/sddm/sddm.conf.d/plasma-wayland.conf called like CompositorCommand=sddm-kwin_wayland.service, then systemd might try to restart kwin_wayland when sddm runs up to 10 times. The frequency of the sddm black screen problem when logging out might be reduced that way until a fix for the kwin_wayland crash is found. I haven't tried this idea yet though. Thanks.

Comment 4 Kamil Páral 2023-02-22 13:18:54 UTC
*** Bug 2172533 has been marked as a duplicate of this bug. ***

Comment 5 Kamil Páral 2023-02-22 13:19:40 UTC
I just received the same crash (reported as bug 2172533) when logging in for the first time after install.

Comment 6 Adam Williamson 2023-02-22 18:40:25 UTC
+7 blocker in https://pagure.io/fedora-qa/blocker-review/issue/1033 , marking accepted.

Comment 7 marcdeop 2023-02-22 20:34:59 UTC
Potentially fixed by: https://invent.kde.org/plasma/kwin/-/merge_requests/3667

Comment 8 Alessandro Astone 2023-02-22 21:31:04 UTC
Verified fixed on rawhide by https://koji.fedoraproject.org/koji/taskinfo?taskID=97872653

Comment 9 Fedora Update System 2023-02-22 22:15:54 UTC
FEDORA-2023-81ff51758d has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-81ff51758d

Comment 10 Fedora Update System 2023-02-23 10:25:32 UTC
FEDORA-2023-81ff51758d has been pushed to the Fedora 38 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-81ff51758d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Adam Williamson 2023-02-23 20:44:31 UTC
Update is going stable, but it'd great if a few more folks could confirm the fix. Matt, have you had a chance to try it?

Comment 12 Fedora Update System 2023-02-23 21:10:19 UTC
FEDORA-2023-81ff51758d has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Matt Fagnani 2023-02-24 01:08:48 UTC
(In reply to Adam Williamson from comment #11)
> Update is going stable, but it'd great if a few more folks could confirm the
> fix. Matt, have you had a chance to try it?

I booted Fedora-KDE-Live-x86_64-38-20230221.n.1.iso in a GNOME Boxes QEMU/KVM VM with 3D acceleration disabled, disabled automatic login from sddm in System Settings, and logged out. This kwin_wayland crash happened on login and logout. I switched to VT2 and ran sudo dnf upgrade which include the Plasma 5.27.1 update with the patch for this problem. I ran sudo systemctl restart sddm and logged in and out a few times. The kwin_wayland crash didn't happen again. Plasma didn't start infrequently and either sddm reappeared or I switched back to it. kwin_wayland didn't crash, but there were crashes of plasmashell, ksplashqml, and other KDE programs, some of which I've seen before. loginctl showed 11 liveuser sessions and 8 sddm sessions simultaneously open which was strange. I saw similar problems on another boot after doing the same things. The several simultaneous sessions is likely a different problem, and I'm not sure if it's related to Plasma 5.27.1 or something else. This kwin_wayland problem should be fixed since Vlad's patch checked if the workspace pointer was null before calling workspace()->geometry().size(). Thanks.

Note You need to log in before you can comment on or make changes to this bug.