Bug 399564 - kwin_wayland segfault on monitor wakeup
Summary: kwin_wayland segfault on monitor wakeup
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.14.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 385743 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-10-09 15:02 UTC by JordanL
Modified: 2018-10-14 15:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.14.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JordanL 2018-10-09 15:02:51 UTC
SUMMARY
When using the Wayland session on KDE Neon 5.14.0, when the powersaving sends the monitors to sleep due to inactivity, and I then wake them up again with mouse/keyboard, kwin crashes.

STEPS TO REPRODUCE
1. Log into Plasma Wayland session
2. Wait for powersaving to send the monitors to sleep
3. Wake up with mouse movement/key press

OBSERVED RESULT
Plasma and KWin are dead. SDDM is still alive. This is in the log (journalctl -b) at the point it crashes:

Oct  9 15:17:11 rupert kernel: [ 1046.307177] kwin_wayland[4108]: segfault at 561cfae8a5e0 ip 00007f68a3ffa1c3 sp 00007ffe84cfa4a8 error 4 in libQt5Gui.so.5.11.1[7f68a3eff000+58d000]


EXPECTED RESULT
Desktop comes back as normal

SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 5.14.0
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION

I'm using two 4k monitors connected via DisplayPort 1.2, to an AMD Vega 64 card, using the standard AMDGPU drivers in the 4.15 kernel.

Full system info:

System:    Kernel: 4.15.0-36-generic x86_64 bits: 64 gcc: 7.3.0
           Desktop: KDE Plasma 5.14.0 (Qt 5.11.1) Distro: KDE neon User Edition 5.14
Machine:   Device: desktop Mobo: MSI model: X99S SLI PLUS (MS-7885) v: 1.0 serial: N/A
           UEFI: American Megatrends v: 1.E0 date: 06/15/2018
CPU:       6 core Intel Core i7-5820K (-MT-MCP-) arch: Haswell rev.2 cache: 15360 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 39599
           clock speeds: max: 3600 MHz 1: 1788 MHz 2: 1837 MHz 3: 1548 MHz 4: 1833 MHz 5: 1779 MHz 6: 1630 MHz
           7: 1636 MHz 8: 2441 MHz 9: 1446 MHz 10: 1695 MHz 11: 1757 MHz 12: 1548 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Vega [Radeon RX Vega] bus-ID: 05:00.0
           Display Server: x11 (X.Org 1.19.6 ) drivers: ati,amdgpu (unloaded: modesetting,fbdev,vesa,radeon)
           Resolution: 3840x2160@60.00hz, 3840x2160@60.00hz
           OpenGL: renderer: Radeon RX Vega (VEGA10 / DRM 3.23.0 / 4.15.0-36-generic, LLVM 6.0.0)
           version: 4.5 Mesa 18.0.5 Direct Render: Yes
Audio:     Card-1 Advanced Micro Devices [AMD/ATI] Device aaf8 driver: snd_hda_intel bus-ID: 05:00.1
           Card-2 Intel C610/X99 series HD Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0
           Sound: Advanced Linux Sound Architecture v: k4.15.0-36-generic
Network:   Card: Intel Ethernet Connection (2) I218-V driver: e1000e v: 3.2.6-k port: f020 bus-ID: 00:19.0
           IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter>
Drives:    HDD Total Size: 500.1GB (25.6% used)
           ID-1: /dev/sda model: Samsung_SSD_840 size: 500.1GB
Partition: ID-1: / size: 457G used: 120G (28%) fs: ext4 dev: /dev/sda2
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 40.0C mobo: N/A gpu: 46.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 293 Uptime: 37 min Memory: 2982.1/11905.9MB Init: systemd runlevel: 5 Gcc sys: 7.3.0
           Client: Shell (bash 4.4.191) inxi: 2.3.56

Log:

At the point the powersaving sent monitors to sleep:
Oct  9 15:15:41 rupert kernel: [  598.515338] [drm] HBR2x4 pass VS=2, PE=0

At the point of wakeup:

Oct  9 15:17:01 rupert CRON[4408]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  9 15:17:10 rupert kernel: [  956.797760] [drm] {3840x2160, 4000x2222@533250Khz}
Oct  9 15:17:10 rupert kernel: [ 1045.725396] [drm] {3840x2160, 4000x2222@533250Khz}
Oct  9 15:17:10 rupert kernel: [ 1045.732945] [drm] HBR2x4 pass VS=1, PE=1
Oct  9 15:17:10 rupert kernel: [ 1045.745082] [drm] {3840x2160, 4000x2222@533250Khz}
Oct  9 15:17:10 rupert kernel: [ 1045.759031] [drm] {3840x2160, 4000x2222@533250Khz}
Oct  9 15:17:11 rupert kernel: [ 1045.766113] [drm] HBR2x4 pass VS=1, PE=1
Oct  9 15:17:11 rupert kernel: [ 1046.307177] kwin_wayland[4108]: segfault at 561cfae8a5e0 ip 00007f68a3ffa1c3 sp 00007ffe84cfa4a8 error 4 in libQt5Gui.so.5.11.1[7f68a3eff000+58d000]
Oct  9 15:17:11 rupert sddm-helper[4073]: [PAM] Closing session
Oct  9 15:17:11 rupert sddm-helper[4073]: [PAM] Ended.
Oct  9 15:17:11 rupert sddm[3626]: Auth: sddm-helper exited successfully
Oct  9 15:17:11 rupert sddm[3626]: Greeter stopping...
Oct  9 15:17:11 rupert sddm[3626]: Socket server stopping...
Oct  9 15:17:11 rupert sddm[3626]: Socket server stopped.
Oct  9 15:17:11 rupert sddm[3626]: Display server stopping...
Oct  9 15:17:11 rupert sddm-greeter[4046]: The X11 connection broke: I/O error (code 1)
Oct  9 15:17:11 rupert systemd[1]: session-22.scope: Killing process 4215 (baloo_file) with signal SIGTERM.
Oct  9 15:17:11 rupert systemd[1]: session-22.scope: Killing process 4240 (sh) with signal SIGTERM.
Oct  9 15:17:11 rupert systemd[1]: session-22.scope: Killing process 4244 (sleep) with signal SIGTERM.
Oct  9 15:17:11 rupert systemd[1]: Stopping Session 22 of user jordan.
Oct  9 15:17:11 rupert systemd[1]: Stopped Session 22 of user jordan.
Oct  9 15:17:11 rupert sddm-helper[4032]: [PAM] Closing session
Oct  9 15:17:11 rupert sddm[3626]: Display server stopped.

There's more logs but they don't seem relevant after this point, I can attach them if needed.
Comment 1 JordanL 2018-10-09 15:19:36 UTC
CORRECTION

The system info I posted above was back in the Xorg session, this is the output of inxi -Fxz while using Wayland:

System:    Host: rupert Kernel: 4.15.0-36-generic x86_64 bits: 64 gcc: 7.3.0
           Desktop: KDE Plasma 5.14.0 (Qt 5.11.1) Distro: KDE neon User Edition 5.14
Machine:   Device: desktop Mobo: MSI model: X99S SLI PLUS (MS-7885) v: 1.0 serial: N/A
           UEFI: American Megatrends v: 1.E0 date: 06/15/2018
CPU:       6 core Intel Core i7-5820K (-MT-MCP-) arch: Haswell rev.2 cache: 15360 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 39599
           clock speeds: max: 3600 MHz 1: 1732 MHz 2: 1389 MHz 3: 1905 MHz 4: 1248 MHz 5: 2240 MHz 6: 1205 MHz
           7: 3057 MHz 8: 1668 MHz 9: 1520 MHz 10: 1320 MHz 11: 2831 MHz 12: 1651 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Vega [Radeon RX Vega] bus-ID: 05:00.0
           Display Server: wayland (X.Org 1.19.6 ) drivers: ati,amdgpu (unloaded: modesetting,fbdev,vesa,radeon)
           Resolution: 3840x2160@59.98hz, 3840x2160@59.98hz
           OpenGL: renderer: Radeon RX Vega (VEGA10 / DRM 3.23.0 / 4.15.0-36-generic, LLVM 6.0.0)
           version: 4.5 Mesa 18.0.5 Direct Render: Yes
Audio:     Card-1 Advanced Micro Devices [AMD/ATI] Device aaf8 driver: snd_hda_intel bus-ID: 05:00.1
           Card-2 Intel C610/X99 series HD Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0
           Sound: Advanced Linux Sound Architecture v: k4.15.0-36-generic
Network:   Card: Intel Ethernet Connection (2) I218-V driver: e1000e v: 3.2.6-k port: f020 bus-ID: 00:19.0
           IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter>
Drives:    HDD Total Size: 500.1GB (25.6% used)
           ID-1: /dev/sda model: Samsung_SSD_840 size: 500.1GB
Partition: ID-1: / size: 457G used: 120G (28%) fs: ext4 dev: /dev/sda2
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 37.0C mobo: N/A gpu: 43.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 290 Uptime: 56 min Memory: 750.9/11905.9MB Init: systemd runlevel: 5 Gcc sys: 7.3.0
           Client: Shell (bash 4.4.191) inxi: 2.3.56
Comment 2 David Edmundson 2018-10-09 15:28:47 UTC
We can't do much to fix a crash without a backtrace.

Getting a backtrace on wayland is a bit hard. Easiest solution is to use another machine, ssh in and run "sudo gdb --pid `pidof kwin_wayland`" then typing "continue" reproducing the crash and typing "backtrace"

Alternatively coredumpctl can help
Comment 3 JordanL 2018-10-09 17:25:37 UTC
(gdb) continue
Continuing.
[Thread 0x7fc9a17fa700 (LWP 5989) exited]
[Thread 0x7fc9a1ffb700 (LWP 5665) exited]
[Thread 0x7fc9a27fc700 (LWP 5664) exited]
[Thread 0x7fc9a2ffd700 (LWP 5663) exited]
[Thread 0x7fc9a37fe700 (LWP 5662) exited]
[Thread 0x7fc9a3fff700 (LWP 5661) exited]
[Thread 0x7fc9a8b71700 (LWP 5660) exited]
[Thread 0x7fc9a9372700 (LWP 5659) exited]
[Thread 0x7fc9aa3b5700 (LWP 5658) exited]
[Thread 0x7fc9bf7cc700 (LWP 5655) exited]

Thread 1 "kwin_wayland" received signal SIGSEGV, Segmentation fault.
0x00007fc9d07841c3 in QGuiApplication::primaryScreen() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
(gdb) backtrace
#0  0x00007fc9d07841c3 in QGuiApplication::primaryScreen() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#1  0x00007fc9d083fc1d in qt_defaultDpiX() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#2  0x00007fc9d07d2fbf in QImageData::QImageData() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#3  0x00007fc9d07d3b6a in QImageData::create(unsigned char*, int, int, int, QImage::Format, bool, void (*)(void*), void*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#4  0x00007fc9d07d3e22 in QImage::QImage(unsigned char*, int, int, int, QImage::Format, void (*)(void*), void*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#5  0x00007fc9bedb5eb3 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#6  0x00007fc9bedac494 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#7  0x00007fc9bedadddc in KWin::DrmOutput::teardown() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#8  0x00007fc9bedadeb0 in KWin::DrmOutput::~DrmOutput() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#9  0x00007fc9bedae039 in KWin::DrmOutput::~DrmOutput() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#10 0x00007fc9beda443f in KWin::DrmBackend::~DrmBackend() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#11 0x00007fc9beda4779 in KWin::DrmBackend::~DrmBackend() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
#12 0x00007fc9d769f747 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007fc9d76a1a7e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007fc9d6ad0615 in __cxa_finalize (d=0x7fc9d7b31960) at cxa_finalize.c:83
#15 0x00007fc9d74b0633 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffcfb09a380 in ?? ()
#17 0x00007fc9d9dc0b73 in _dl_fini () at dl-fini.c:138
Backtrace stopped: frame did not save the PC
(gdb) exit
Comment 4 David Edmundson 2018-10-09 18:31:40 UTC
I did not expect it there. 

Thanks very much.
Comment 5 Rainer Finke 2018-10-09 20:04:21 UTC
I have the same issue since a long time, but was not able to get a lot of debug output on Arch Linux https://bugs.kde.org/show_bug.cgi?id=385743.
Comment 6 Rainer Finke 2018-10-09 20:06:26 UTC
*** Bug 385743 has been marked as a duplicate of this bug. ***
Comment 7 JordanL 2018-10-10 08:56:58 UTC
Should have mentioned, this bug was also present in 5.13.*.
Comment 8 JordanL 2018-10-10 09:26:20 UTC
5.13.* was the first release I tried Wayland in, so this bug might have been around long before that.
Comment 9 David Edmundson 2018-10-10 10:14:44 UTC
Git commit 6724955a762413bcc6b87e4909eadab593376f2a by David Edmundson.
Committed on 10/10/2018 at 10:14.
Pushed by davidedmundson into branch 'Plasma/5.14'.

[qpa] Always keep a at least one screen

Summary:
Qt does not like having no screens. Both Qt XCB and Wayland QPAs have
systems pretend there's always at least 1 screen
present.

Kwin already uses a dummy screen on startup, this patch reinserts the
dummy screen if the platform states that all real screens are removed.

Test Plan:
Logged in, everything still worked
Did not reproduce the original bug

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

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

M  +6    -0    plugins/qpa/integration.cpp

https://commits.kde.org/kwin/6724955a762413bcc6b87e4909eadab593376f2a