Bug 413758 - KWin_wayland crashes when an external display is unplugged
Summary: KWin_wayland crashes when an external display is unplugged
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.17.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-02 19:54 UTC by madcatx
Modified: 2020-04-07 22:25 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Wayland session log with debugging enabled (97.25 KB, text/x-log)
2019-11-02 19:54 UTC, madcatx
Details
Backtrace from GDB (3.06 KB, text/plain)
2019-11-02 19:54 UTC, madcatx
Details
KWin support information (6.07 KB, text/plain)
2019-11-02 20:05 UTC, madcatx
Details
Backtrace from GDB with debugging info (2.99 KB, text/plain)
2019-11-03 10:00 UTC, madcatx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description madcatx 2019-11-02 19:54:20 UTC
Created attachment 123670 [details]
Wayland session log with debugging enabled

I can reproduce this reliably with my Dell display that connects to VGA port.

STEPS TO REPRODUCE
1. Start a KDE Wayland session
2. Plug in the external display
3. KWin switches display output, ext. screen enabled, laptop display disabled - this is okay
4. Disconnect the external display
5. Session crashes

This is on a ThinkPad T420 laptop with Intel HD3000 GPU. There is also no issue under X11.
Comment 1 madcatx 2019-11-02 19:54:52 UTC
Created attachment 123671 [details]
Backtrace from GDB
Comment 2 madcatx 2019-11-02 20:05:45 UTC
Created attachment 123672 [details]
KWin support information
Comment 3 Roman Gilg 2019-11-02 21:22:15 UTC
Thanks for the report. You need to install debug symbols to make the GDB output useful.
Comment 4 madcatx 2019-11-03 10:00:41 UTC
Created attachment 123690 [details]
Backtrace from GDB with debugging info

I had to rebuild KWin with debugging info. The backtrace seems more useful now.
Comment 5 Roman Gilg 2019-12-11 12:43:13 UTC
Thanks, can you still reproduce? From the backtrace it seems it tries to access in
https://cgit.kde.org/kwin.git/tree/plugins/platforms/drm/egl_gbm_backend.cpp?h=Plasma/5.17#n352
an output property, but this output does not exist anymore.

Since you have the laptop disabled and the other screen disconnected I guess there is a short time where no output is active and we have the problem as in:
https://phabricator.kde.org/T10016
Comment 6 Roman Gilg 2020-01-08 09:12:01 UTC
Git commit 2632e4182c658178af82be175575b094002468af by Roman Gilg.
Committed on 08/01/2020 at 09:12.
Pushed by romangilg into branch 'master'.

[platforms/drm] Allow running without outputs

Summary:
Set outputs enablement also when none outputs are present. This patch is
similar to earlier attempt at D17985.
Related: bug 402827, bug 389551, bug 398680

Test Plan:
Starting without outputs, manual disconnects and DPMS changes. There is still
an issue when an output gets disconnected while the DPMS is off. But it's an
improvement already.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T10016

Differential Revision: https://phabricator.kde.org/D26511

M  +2    -6    plugins/platforms/drm/drm_backend.cpp

https://commits.kde.org/kwin/2632e4182c658178af82be175575b094002468af
Comment 7 madcatx 2020-02-23 17:29:37 UTC
I just checked with KWin 5.18.1 and while it does not seem to actually crash, current behavior still results in a useless system once the external screen gets disconnected. It now behaves like this:

1) Start with no external screens connected, OK
2) Connect external screen, OK
3) Output moves to external screen, internal screen gets disabled, OK
4) Disconnect external screen
5) Internal screen stays dark and there is no way how to resurrect the machine bar killing KWin an restarting the whole session.

I tried to attach gdb to KWin when it gets into this state but I don't think the output is particularly useful:

(gdb) bt
#0  0x00007f9d9ca87bb6 in ppoll () at /usr/lib/libc.so.6
#1  0x00007f9d9d065f73 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/libQt5Core.so.5
#2  0x00007f9d9d06763d in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#3  0x00007f9d95dd0e8e in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/qt/plugins/platforms/KWinQpaPlugin.so
#4  0x00007f9d9d0104cc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f9d9d0184d6 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#6  0x000056375e44931c in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /home/madcat/abs/kwin/trunk/src/kwin-5.18.1/main_wayland.cpp:676