Wayland / Plasma: Application windows not showing up, cause session crash

For the past years I’ve been wishing to switch from X11 to Wayland and enjoy its performance improvements and other capabilities. Unfortunately even in the latest openSUSE Tumbleweed snapshot, a KDE / Plasma session will cause not just graphical glitches but also session crashes back to the login screen. I wanted to discuss the main one I’ve ran into during today’s tests, before deciding if I should report this as a bug too.

Apart from the changing cursor size and harmless graphical glitches I could live with temporarily, Wayland seems to introduce a strange bug on amdgpu: Sometimes when you open an application, like from say the Kickoff launcher, the window of that application will never appear. The application process itself does start as I can see it in KSysGuard without any sleep status applied, where sending it a kill signal will quickly shut it down proving it’s responsive. There is however no window or taskbar entry, although it feels like the desktop is trying to select something that doesn’t exist. At this stage, if I use the scroll wheel to go to the other desktop and then back, everything will freeze for a few seconds followed by a black screen and waking up back in the login manager.

Someone suggested I try booting with amdgpu.dc=0. I did so but due to there still being crashes and bizarre visual glitches, it was hard to tell if that made this particular issue go away. I still crashed back to SDDM once but I think it may have been a different trigger. Anyone else getting this particular problem and knows when we can expect a solution?

Yes, it’s still very much work-in-progress. (I have found that it seems to behave okay in a vbox environment though.)

Similar report here
https://forums.opensuse.org/showthread.php/537973-Upgraded-to-15-1-Plasma-KDE-KDE-Wayland-and-AMDGPU
however, these are upstream issues - not specific to openSUSE of course.

I booted with amdgpu.dc=0 once more to make sure that doesn’t fix it, and indeed it doesn’t affect the issue. There’s only workaround at the moment: When I open an application and its window doesn’t show up, open KSysGuard and kill its process… opening that application again usually works fine then. Just don’t switch desktops until the windowless process is killed, else the session will crash.

Since it’s late anyway I’ll wait for more replies until tomorrow, then probably file a bug report with the info I have. Currently I’m managing to keep a WayLand session up and running during everyday use, but walking on eggshells as any wrong move can crash and log me out.

Went ahead and reported the issue where relevant, it contains more detail on what’s happening. Unfortunately the Freedesktop team adopted a “not our problem, ask the Plasma devs to deal with it” approach and instantly closed my ticket… really hoping the KDE team won’t circle the issue back to Wayland, which would mean no one’s going to fix it and though luck to us users; x11 is starting to have its noticeable limitations, switching to Wayland may become a requirement… but it’s an impossible nightmare to deal with those invisible windows until we find what setting or driver is causing this bug on setups similar to mine. Will wait for more info.

https://bugzilla.opensuse.org/show_bug.cgi?id=1169304
https://bugs.kde.org/show_bug.cgi?id=420039
https://gitlab.freedesktop.org/wayland/wayland/-/issues/155

I see that there is already a reply to the openSUSE bugzilla report about trying to launch the plasma compositor with “LIBGL_ALWAYS_SOFTWARE=1” (to force software rendering) in a tty to see whether that helps.

More info concerning the Mesa environment variables…
https://www.mesa3d.org/envvars.html

Following a suggestion on the openSUSE bug tracker: I switched to the default Breeze KWin theme followed by logging out and back in. No change, issue still occurred.

Attempting to start a test session with “LIBGL_ALWAYS_SOFTWARE=1 dbus-launch-session startplasmacompositor” wasn’t possible as dbus-launch-session was reported as an unrecognized command when I looked at it. However I could solve this by adding “export LIBGL_ALWAYS_SOFTWARE=1” to ~/.profile then starting a new session normally: I can tell it worked since all desktop effects were disabled and the mouse cursor was extremely laggy (everything felt like it ran at 5 FPS). To my surprise even this didn’t affect the issue, both the missing windows and session crash could still be reproduced after a number of attempts.

I remember playing with these years ago when debugging a GPU crash. There are tons of parameters, it’s hard to test all or guess which may affect it. But since even a session started with LIBGL_ALWAYS_SOFTWARE=1 produces the issue, I’m assuming Mesa isn’t the culprit or involved in the chain of events triggering this.

Hopefully, you’ll get further guidance on the next steps to help progress this. Some strange interaction with the compositor and window placement or similar it would seem.

BTW, are you running a multi-display environment?

Really hope so too. Since it’s noticeably slower and also has some issues with monitor standby, I’d really like to not go back to X11 if I can help it. This and some seemingly unrelated crashes are a huge problem with Wayland though, using it in such a state requires a lot of attention to dodge the crashes. But since the amdgpu module is commonly used and other users aren’t jumping in to say “I see it too” I’m hoping it might be just an obscure setting I can turn off to make it go away.

I do have a VR headset plugged in as well, but it’s disabled as a device from the settings so it shouldn’t be in use at all. Might be worth pointing out that I’m using an 144 Hz monitor (1080p) connected via DisplayPort cable… I’d be shocked if this is the cause though.

The reality is I don’t think many are using Plasma/Wayland (especially full Wayland) as their daily driver. It’s work in progress, but I think it is important to test its capabilities (for those who can) to help with bug reporting etc. It seems to behave better in a virtual environment which is probably not surprising (given often used for development purposes).

Thanks again Fabian Vogt from the openSUSE tracker for the new suggestions. Sharing the tests and results here too once more.

Regarding whether this affects just Wayland or X11 clients: I don’t know how to check which is which. However the issue does affect both Qt and GTK applications, KDE components or otherwise; So far I’ve seen it happen to KWrite, Konsole, KSysGuard, Firefox, Thunderbird, Audacious, etc. Since the first are default KDE components I’m assuming they’re ran as native WL clients?

In a console I set “export WAYLAND_DEBUG=1” followed by repeatedly launching and closing “kwrite”. When eventually it opened with a hidden window, nothing was printed to this console. I killed the process and it only said “Terminated”.

I took a backup of ~/.config/plasma-org.kde.plasma.desktop-appletsrc to save my widget config, then successfully managed to use “dbus-run-session startplasma-wayland --xwayland --x11-display $DISPLAY --exit-with-session=/usr/lib64/libexec/startplasma-waylandsession” and start another session in a smaller window from within my normal session… I also set “export WAYLAND_DEBUG=1” in the console that spawned this debug session. I could reproduce the crash in this controlled environment too! Here’s the output that was produced in the console running the nested session as that session collapsed:

The Wayland connection broke. Did the Wayland compositor die?
Service  ":1.5" unregistered
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
KCrash: Application 'kdeconnectd' crashing...
The Wayland connection broke. Did the Wayland compositor die?
(EE) failed to read Wayland events: Connection reset by peer
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
"/usr/bin/kwin_wayland" ("--xwayland", "--x11-display", ":1", "--exit-with-session=/usr/lib64/libexec/startplasma-waylandsession") exited with code 11
startplasmacompositor: Shutting down...
startplasmacompositor: Done.
org.kde.knotifications: env says KDE is running but SNI unavailable -- check KDE_FULL_SESSION and XDG_CURRENT_DESKTOP
The X11 connection broke (error 1). Did the X11 server die?
mircea@linux-qz0r:~> Gdk-Message: 16:55:37.847: geany: Fatal IO error 11 (Resource temporarily unavailable) on X server :2.

The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
org.kde.pim.akonadiserver: Subscriber "SpecialCollectionsMonitor - 93989194988816" disconnected
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
org.kde.pim.akonadiserver: Subscriber "SpecialCollectionsMonitor - 94808550392064" disconnected
kdeinit5: Fatal IO error: client killed
kdeinit5: sending SIGHUP to children.
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
kdeinit5: sending SIGTERM to children.
kdeinit5: Exit.
The X11 connection broke (error 1). Did the X11 server die?
The X11 connection broke (error 1). Did the X11 server die?
klauncher: Exiting on signal 15
klauncher: Exiting on signal 1
The X11 connection broke (error 1). Did the X11 server die?
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94815390863600" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94237770427552" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 93922727390192" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94808550262528" disconnected
org.kde.pim.akonadiserver: Subscriber "akonadi_maildispatcher_agent - 94808550320912" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 30460528" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94889553774624" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 93946156200368" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94604754354512" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94479107463888" disconnected
org.kde.pim.akonadiserver: Subscriber "akonadi_birthdays_resource - 94479108419744" disconnected
WARNING ../src/audacious/main.cc:318 [main_cleanup]: exit() called unexpectedly; skipping normal cleanup.
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94171675233888" disconnected
org.kde.pim.akonadiserver: Subscriber "KNotes Session - 94573788775056" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94573787822144" disconnected

** (zeitgeist-datahub:11941): WARNING **: 16:55:37.858: zeitgeist-datahub.vala:224: Unable to get name "org.gnome.zeitgeist.datahub" on the bus!
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 93952615237872" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94919006869168" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94580347672576" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94257760094352" disconnected
[13:55:37.860847 WARNING] zeitgeist-daemon.vala:453: The connection is closed
The X11 connection broke (error 1). Did the X11 server die?
A connection to the bus can't be made
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94320471285232" disconnected
org.kde.pim.akonadiserver: Subscriber "ETMCalendarMonitor - 94725931742432" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 93935000592720" disconnected
QSocketNotifier: Invalid socket 6 and type 'Read', disabling...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
org.kde.pim.akonadiserver: Control process died, committing suicide!
"QLocalSocket: Remote closed" "/run/user/1000/akonadi/akonadiserver-cmd.socket"
"QLocalSocket: Remote closed" "/run/user/1000/akonadi/akonadiserver-cmd.socket"
org.kde.pim.akonadiserver: Subscriber "MailFilter Kernel ETM - 93989195084128" disconnected
org.kde.pim.akonadiserver: Subscriber "MailFilterItemMonitor - 93989195119904" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 94119478474928" disconnected
org.kde.pim.akonadiserver: Subscriber "MailFilterCollectionMonitor - 93989195135120" disconnected
org.kde.pim.akonadiserver: Subscriber "ArchiveMailCollectionMonitor - 94119478525392" disconnected
org.kde.pim.akonadiserver: Subscriber "AgentBaseChangeRecorder - 93989194985664" disconnected
org.kde.pim.akonadiserver: Subscriber "Archive Mail Kernel ETM - 94119478551440" disconnected
"QLocalSocket: Remote closed" "/run/user/1000/akonadi/akonadiserver-ntf.socket"
"QLocalSocket: Remote closed" "/run/user/1000/akonadi/akonadiserver-ntf.socket"
KCrash: Attempting to start /usr/lib64/libexec/org_kde_powerdevil from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/libexec/org_kde_powerdevil directly
QSocketNotifier: Invalid socket 22 and type 'Read', disabling...
QSocketNotifier: Invalid socket 23 and type 'Read', disabling...
KCrash: Application 'org_kde_powerdevil' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/libexec/drkonqi directly
Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

KCrash: Attempting to start /usr/bin/kded5 from kdeinit
sock_file=/run/user/1000/kdeinit5__2
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/bin/kded5 directly
KCrash: Attempting to start /usr/bin/plasmashell from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/bin/plasmashell directly
QSocketNotifier: Invalid socket 22 and type 'Read', disabling...
QSocketNotifier: Invalid socket 23 and type 'Read', disabling...
KCrash: Application 'kded5' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__2
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/libexec/drkonqi directly
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
QSocketNotifier: Invalid socket 48 and type 'Read', disabling...
QSocketNotifier: Invalid socket 49 and type 'Read', disabling...
KCrash: Application 'plasmashell' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/libexec/drkonqi directly
Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Unable to start Dr. Konqi
Re-raising signal for core dump handling.
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
Unable to start Dr. Konqi
Re-raising signal for core dump handling.

It appears that on rare occasions, some of these windows will end up causing graphical corruption and leaving weird trails behind. I noticed something like this before but didn’t make a connection until now. Just caught a lucky break and managed to take a screenshot, posting in case it helps offer a pointer.

https://i.imgur.com/z07tI8P.png

Output of gdb debug session recorded with: dbus-run-session gdb --args startplasma-wayland --xwayland --x11-display $DISPLAY --exit-with-session=/usr/lib64/libexec/startplasma-waylandsession > ./output 2>&1

https://pastebin.com/9VtQq1QN

I’m also glad to announce I’ve apparently discovered an essential piece of the puzzle, just tested this heavily and will continue to do so. It appears this glitch only occurs when minimized windows are present in the session; If there are either no other windows or the existing windows are all maximized or restored, opening a new application seems to work just fine. This further caught my attention as some existing windows also rarely freeze (still rendered but visually unchanged) until I minimize and restore them… one of the similar bug reports additionally stated that minimizing and restoring hidden windows with a shortcut might recover them (I don’t have this shortcut to test).

It appears I found a workaround and potentially the culprit, more testing required but it seems pretty certain so far. System Settings - Hardware - Display and Monitor - Compositor: “Keep window thumbnails” has to be set to “Always”, the options “Never” or “Only for Shown Windows” are introducing this glitch. Although taskbar thumbnails still don’t show up when hovering over an icon, I’ve been able to minimize and play around with opening / closing windows without getting the invisible windows and associated crashes any more.

This also seems to fix another crash I thought was unrelated: When reordering applications on the taskbar (icon-only task manager widget) by click-dragging them, a crash would also occur for some applications. I’m reordering those applications now and no longer seem to be getting a session lock.

PROPER gdb debug of the nested session as it crashes: https://pastebin.com/WTKp4TYZ