Bug 390306 - kwin_wayland terminates when closing laptop lid
Summary: kwin_wayland terminates when closing laptop lid
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 5.12.0
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-12 08:08 UTC by Fabian Vogt
Modified: 2023-09-21 12:10 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
mgraesslin: Wayland+
mgraesslin: X11-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Vogt 2018-02-12 08:08:08 UTC
The plasma wayland session works just fine if I start it while the lid is open.
Both external screens and the internal screen display the expected picture.
When I close the lid, the entire session terminates.
This does not happen with just kwin_wayland --xwayland --drm --libinput --exit-with-session="konsole"
so it is probably related to kscreen (?)

I get a crash on exit as ~DrmBackend during dl_fini calls processEvents (so Qt aborts),
but that seems unrelated.

powerdevil: Lid action was suppressed because an external monitor is present
kf5idletime_kwayland: This plugin does not support polling idle time
Service  ":1.3" unregistered
kwin_wayland: Couldn't find current GLX or EGL context.

Service  ":1.5" unregistered
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
The Wayland connection broke. Did the Wayland compositor die?
*** Error in `/usr/lib64/libexec/org_kde_powerdevil': double free or corruption (out): 0x000055a95bd04900 ***
QSocketNotifier: Invalid socket 24 and type 'Read', disabling...
QSocketNotifier: Invalid socket 25 and type 'Read', disabling...
The Wayland connection broke. Did the Wayland compositor die?
QSocketNotifier: Invalid socket 27 and type 'Read', disabling...
QSocketNotifier: Invalid socket 28 and type 'Read', disabling...
(EE) 
Fatal server error:
(EE) failed to read Wayland events: Broken pipe
(EE) 
KCrash: Application 'org_kde_powerdevil' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
Empty filename passed to function
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?
kdeinit5: Fatal IO error: client killed
kdeinit5: sending SIGHUP to children.
kdeinit5: sending SIGTERM to children.
kdeinit5: Exit.
Unexpected response from KInit (response = 0).
startplasma: Could not start ksmserver. Check your installation.
Error: Can't open display: :1
startplasma: Shutting down...
Comment 1 Martin Flöser 2018-02-12 15:49:29 UTC
The crash on exit is unrelated, but also interesting: the DrmBackend should not be destroyed from a dl_fini, but from destroying the QApplication. So we are in an unorded destroy.

What would be interesting to see is what triggers KWin in going down. The log does not give a hint :-(
Comment 2 Martin Flöser 2018-02-12 15:50:12 UTC
What might be related is: https://bugs.kde.org/show_bug.cgi?id=389551#c7
Comment 3 Fabian Vogt 2018-02-13 08:03:56 UTC
I just confirmed that it's indeed kscreen what's causing this: Turing the laptop screen off in the kscreen kcm kills the session as well.

This laptop uses switchable graphics (optimus, or whatever it's called), so that might be related. Maybe the hardware switches from the intel GPU to the nvidia one when the laptop screen gets deactivated? I don't see any flicker or similiar on X or VTs though, so that's unlikely.
Comment 4 Fabian Vogt 2018-02-13 08:34:48 UTC
kwin_wayland crash at the end (not really helpful I guess):

Thread 1 "kwin_wayland" received signal SIGABRT, Aborted.
0x00007fba265cf0d0 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007fba265cf0d0 in raise () at /lib64/libc.so.6
#1  0x00007fba265d06b1 in abort () at /lib64/libc.so.6
#2  0x00007fba269ec205 in __gnu_cxx::__verbose_terminate_handler() () at /usr/lib64/libstdc++.so.6
#3  0x00007fba269e9ff6 in  () at /usr/lib64/libstdc++.so.6
#4  0x00007fba269e8fb9 in  () at /usr/lib64/libstdc++.so.6
#5  0x00007fba269e9928 in __gxx_personality_v0 () at /usr/lib64/libstdc++.so.6
#6  0x00007fba1f1ae3c3 in  () at /lib64/libgcc_s.so.1
#7  0x00007fba1f1aebee in _Unwind_Resume () at /lib64/libgcc_s.so.1
#8  0x00007fba27191d20 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#9  0x00007fba271e3b64 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#10 0x00007fba1138242d in  () at /usr/lib64/qt5/plugins/platforms/KWinQpaPlugin.so
#11 0x00007fba0e1d5262 in KWin::DrmBackend::~DrmBackend() () at /usr/lib64/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#12 0x00007fba0e1d55b9 in KWin::DrmBackend::~DrmBackend() () at /usr/lib64/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#13 0x00007fba27184476 in QLibraryPrivate::unload(QLibraryPrivate::UnloadFlag) () at /usr/lib64/libQt5Core.so.5
#14 0x00007fba271867be in (anonymous namespace)::qlibraryCleanup_dtor_class_::~qlibraryCleanup_dtor_class_() () at /usr/lib64/libQt5Core.so.5
#15 0x00007fba265d2052 in __cxa_finalize () at /lib64/libc.so.6
#16 0x00007fba26f8bf63 in __do_global_dtors_aux () at /usr/lib64/libQt5Core.so.5
#17 0x00007ffcc9dc9f70 in  ()
#18 0x00007fba29844123 in _dl_fini () at /lib64/ld-linux-x86-64.so.2

I also tried moving the laptop screen to the middle and then disabling it. Result:

kscreen: Correcting output positions by: QPoint(1920,0)
kscreen: Moved output from QPoint(1920,0) to QPoint(0,0)
kscreen: Moved output from QPoint(3840,0) to QPoint(1920,0)
Service  ":1.3" unregistered
kwin_wayland: Couldn't find current GLX or EGL context.

Service  ":1.5" unregistered

I did also see the "Compositor does not support running without screens" message once,
but could not reproduce that.
Comment 5 Nate Graham 2021-01-13 18:44:57 UTC
#6  QMessageLogger::fatal (this=this@entry=0x7fffd70c5ba0, msg=msg@entry=0x7ff994ac00b8 "The Wayland connection broke. Did the Wayland compositor die?") at global/qlogging.cpp:893

This means that the compositor crashed. Due to a Qt issue, when this happens, the app using it will crash too. KDE developers submitted a fix, but sadly it was not merged. See https://codereview.qt-project.org/c/qt/qtwayland/+/308984.

Until we get better handling of this in Qt, the best we can do is debug why the compositor crashed in the first place. So can you please get a backtrace of the crash in kwin_wayland and then file a new bug report with it on kwin | wayland-generic? Thanks!

You may be able to use the `coredumpctl` utility to retrieve the backtrace. See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports#Retrieving_a_backtrace_using_coredumpctl
Comment 6 Zamundaaa 2023-09-21 12:10:17 UTC
This bug report is really old now and the drm backend has been pretty much rewritten twice since 2018, so I assume this is no longer happening