Bug 343674

Summary: Plasma is brought down by libqxcb segfaults with the screen locked & switched off
Product: [Plasma] plasmashell Reporter: kozthe
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED WORKSFORME    
Severity: grave CC: artjom.simon, asturm, benoit.poupaert, bhush94, bibdoc, bj.cardon, daniel.goertzen, diabelko, excessneo, hazica, kstars, mariuskowals, rdieter
Priority: NOR Keywords: triaged
Version: 5.2.0   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=353271
Latest Commit: Version Fixed In:
Attachments: dmesg tail
xsession log containing the crash information

Description kozthe 2015-02-02 02:34:41 UTC
Plasma crashes to sddm at some point after the screen is locked and/or turned off, I believe this happens when the monitor stops receiving a signal and turns itself off - I have had it happen by turning off the monitor (without screen being locked). This does not happen every time.

Dmesg always says this:

[189081.458135] kactivitymanage[21703]: segfault at 18 ip 00007fde5d2e4dc2 sp 00007fffe572ddb8 error 4 in libqxcb.so[7fde5d2bb000+80000]
[189081.817382] kscreen_backend[21671]: segfault at 8 ip 00007faf55c3cb10 sp 00007fffb6c732b8 error 4 in libQt5Gui.so.5.4.0[7faf55b2c000+4f2000]
[189082.152096] krunner[27924]: segfault at 18 ip 00007ff68ccbcfbc sp 00007fff1f706430 error 4 in libqxcb.so[7ff68cc7a000+80000]
[189082.152575] plasmashell[27926]: segfault at 18 ip 00007fdf82643fbc sp 00007fff2ca0ab10 error 4 in libqxcb.so[7fdf82601000+80000]
[189082.153101] kwin_x11[27928]: segfault at 18 ip 00007f414c0d4fbc sp 00007fffc650e450 error 4 in libqxcb.so[7f414c092000+80000]
[189082.642135] sddm-greeter[27969]: segfault at 18 ip 00007f23ca124fbc sp 00007fff711d34b0 error 4 in libqxcb.so[7f23ca0e2000+80000]



Reproducible: Sometimes

Steps to Reproduce:
1. Screen Locked
2. Monitor off
Comment 1 David Edmundson 2015-02-03 08:43:32 UTC
What Qt version?
Comment 2 kozthe 2015-02-04 00:13:01 UTC
(In reply to David Edmundson from comment #1)
> What Qt version?

Qt version 5.4.0
Comment 3 Jamie 2015-03-06 17:30:35 UTC
Created attachment 91454 [details]
dmesg tail
Comment 4 Jamie 2015-03-06 17:31:40 UTC
I seem to have a similar issue. I am using sddm and KDE plasma version 5.2.1.
When I shut off my monitor and then turn it back on I get almost the same segfault.
There are a lot of errors saying 'Qt: Session management error: could not open network socket'
Also I am not getting a crash back to sddm to login. It's just blank, in fact my monitor says no signal until I change to a console terminal.

Qt 5.4.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 4.9.2) on "xcb" 
OS: Ubuntu Vivid Vervet (development branch) [linux version 3.16.0-25-generic]

I'm attaching the dmesg tail and the xsession log in the hope that they are useful.
Comment 5 Jamie 2015-03-06 17:33:12 UTC
Created attachment 91455 [details]
xsession log containing the crash information
Comment 6 Adam 2015-05-01 18:35:31 UTC
I'm getting this issue on boot with my laptop didn't happen first boot but after installing nvidia drivers which could be related.

[   22.937265] vgaarb: this pci device is not a vga device
[   24.483532] show_signal_msg: 18 callbacks suppressed
[   24.483535] sddm-greeter[1143]: segfault at 18 ip 00007f9c1b283059 sp 00007ffe929fad90 error 4 in libqxcb.so[7f9c1b239000+b9000]

I got past it by restarting the sddm service in a different run level though the login prompt was a bit mangled.
Comment 7 Makowal 2015-05-08 01:27:11 UTC
I can confirm the same bug on Nvidia (Optimus with proprietary drivers set to use Nvidia) on boot (sometimes it boot normally, sometimes stay black with the above communicate on dmesg).

(I'm on newest Kubuntu 15.04, fully updated, KDE Plasma 5.2.2, Qt 5.4.1, kernel 3.19.0-16-generic, 64 bit).
Comment 9 artjom.simon 2015-06-03 11:29:46 UTC
I removed a Thinkpad T431s, out of its docking station while it was connected to a second monitor.
This caused a desktop corruption (image offset / wrapping effect), so I killed the Xorg with Ctrl+Alt+Backspace, causing X and sddm to respawn.

Trying to re-login in sddm shows a black desktop for a short time, then X and sddm respaw.

dmesg shows the following:

[ 3430.612050] kscreen_backend[10242]: segfault at 10 ip 00007fd87336ae00 sp 00007ffe1e204ac8 error 4 in KSC_XRandR.so[7fd873355000+24000]
[ 3431.470117] kactivitymanage[10237]: segfault at 18 ip 00007f24851c95d0 sp 00007ffdabffe4d8 error 4 in libqxcb.so[7f248519c000+b6000]
[ 3431.585810] ksplashqml[10194]: segfault at 8 ip 00007ff56ef91250 sp 00007ffe26931148 error 4 in libQt5Gui.so.5.4.1[7ff56ee82000+523000]
[ 3431.715508] kscreen_backend[10253]: segfault at 18 ip 00007f2e34a28439 sp 00007ffd6ef57e90 error 4 in libqxcb.so[7f2e349e0000+b6000]
[ 3431.717923] kaccess[10255]: segfault at 18 ip 00007f297f55e439 sp 00007ffc3d1de460 error 4 in libqxcb.so[7f297f516000+b6000]
[ 3431.936218] ksmserver[10264]: segfault at 18 ip 00007fa6eacb8439 sp 00007ffd4253fcd0 error 4 in libqxcb.so[7fa6eac70000+b6000]

Reinstallign the corresponding packages (qt5-base, libkscreen) doesn't solve the problem.
Removing / renaming  the .cache, .config and .kde4 directories doesn't help.

As I see it, the problem has nothing to do with sddm since the problem occurs if you do "startx" from the console (while having "exec startkde" in your .xinitrc)

Other users on the same systems can log in perfectly fine.

Any suggestions where else to search for the cause or how to work around it?
Comment 10 Max 2015-06-21 15:47:10 UTC
Confirm this on my Intel HD5500 on Kubuntu 15.04 with Plasma 5.3 from Backports. Using opensource drivers. 

Shutting down the the monitor does not trigger any problems in the log files, as far as I can tell. Starting the monitor up again triggers the errors and kills Plasma/KDE. 

A workaround would be appreciated. I strongly suspect this not to be a user-based config issue, since I am able to reproduce the error with a newly created user.
Comment 11 Max 2015-06-21 21:24:20 UTC
Tried to reproduce with a "regular" 24''  monitor connected via HDMI->DVI adapter and failed. Is there any way I can provide additional debug info, to help the experts pinpoint the issue? This is really pissing me off...
Comment 12 Max 2015-06-22 17:51:15 UTC
It seems to me like this is a bug in Qt, that was fixed in version 5.5 according to this ticket.
https://bugreports.qt.io/browse/QTBUG-38326
and the ones it links to.
Comment 13 diabelko 2015-09-23 10:04:55 UTC
Hi,

I've managed to work around this problem very easily. Each time it occurs it is actually caused by some display configuration held by kscreen in .local/share/kscreen/

Rest of components segfaults because they cannot display anything.

Hope that helps.
Comment 14 Max 2015-09-27 11:16:48 UTC
Hi diabelko@hackerspace.pl.

Care to elaborate on that? It isn't quite clear what your workaround consists of.

Thanks
Comment 15 diabelko 2015-09-27 14:27:01 UTC
Max,

my 'solution' is to remove all files from .local/share/kscreen/. Somehow when you connect same monitor model with different configuration (i.e. on the left, on the right or into different HDMI/DP port) kscreen files tend to get mixed up and you end up with kscreen segfault. After kscreen has segfault, everything else segfaults since it cannot be displayed.

I know this is not a long-term solution, however this is the only thing that allows me to continue using KDE at the moment.
Comment 16 Thomas Lübking 2015-09-28 21:08:40 UTC
I bet on the QScreen 0x0 bug, https://bugreports.qt.io/browse/QTBUG-47385
See https://bugs.kde.org/show_bug.cgi?id=341497 for another list (with backtraces)

If you can reliably reproduce this, attach (from VT1) gdb to a process prone to crash, crash and inspect the stack. You'll most likely find a nullptr deref in QScreen.
Comment 17 bj.cardon 2015-12-17 23:01:02 UTC
God almighty diabelko! You solved my problem. I am.seeing this very frequently, especially when plugging and unplugging screens across reboots on an Optimus laptop. The last time it got stuck like this I just reinstalled from.scratch but it was definitely one of the profiles in kscreen that was messing everything up.

For reference, I saw the same kscreen segfaults mentioned above. Following which sddm would dump to a black screen. It seems easily reproducible on my laptop if I boot with a DisplatPort device attached and then detach it and plug in HDMI. Both plugs go to the same screen so it is possible it somehow gets confused by the EDID info that comes back or something.
Comment 18 bibdoc 2016-01-14 07:01:02 UTC
Thanks, diabelko@hackerspace.pl, removing .local/share/kscreen contents did the trick. In my case, I've unplugged a sleeping laptop with a secondary screen attached. Black screen, even when display manager shown correctly. Installed LXDE from console and googled a bit from there.
Comment 19 Jasem Mutlaq 2016-05-08 19:18:32 UTC
*** Bug 362822 has been marked as a duplicate of this bug. ***
Comment 20 Andrew Crouthamel 2018-09-26 22:07:15 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 21 Andrew Crouthamel 2018-10-27 03:39:13 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!