Bug 416914

Summary: Connecting external monitor freezes Plasma
Product: [Plasma] plasmashell Reporter: waldauf <wwwaldauf>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED WORKSFORME    
Severity: crash CC: nate, plasma-bugs
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description waldauf 2020-01-29 15:59:57 UTC
SUMMARY
Connecting an external monitor to my laptop Lenovo T470p (over HDMI, or mDP or over docking station) caused hang of plasmashell. 

On Arch forum I found out other people having the same problem.

STEPS TO REPRODUCE
1. Run KDE
2. Connect external monitor
3. Work

OBSERVED RESULT
Symptoms:
* Clock gets stuck
* Not possible to click with the mouse anywhere - choose some window, right-click, application menu.
* Not possible to unlock screen (SDDM must be restarted)
* Multimedia keys for volume don't work
* Windows react to mouse click with delay (i.e. switch tab in browser)
* Wallpapers disappeared (often)
* Default panel disappeared (almost everytime)
* Kwin is loading one from 8 CPU to 100% (sometimes)
* Keyboard works (mostly), so you can switch to TTYx and restart SDDM

Quick win is in while loop restart of plasmashell:
while true; do killall plasmashell && kstart5 plasmashell; sleep 120; done


EXPECTED RESULT
Working KDE environment.


SOFTWARE/OS VERSIONS
Information about system & KDE:
Operating System: Arch Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Kernel Version: 5.4.15-arch1-1


Packages containing plasma:
extra/plasma-workspace-wallpapers 5.17.5-1
extra/plasma-workspace 5.17.5-2
extra/plasma-sdk 5.17.5-1
extra/plasma-pa 5.17.5-1
extra/plasma-nm 5.17.5-1
extra/plasma-integration 5.17.5-1
extra/plasma-framework 5.66.0-1
extra/plasma-desktop 5.17.5-2

ADDITIONAL INFORMATION

I found out how to debug kwin_x11 (https://community.kde.org/KWin/Debugging):
$ gdb --pid `pidof kwin_x11` 2>&1 | tee kwin.gdb
Excess command line arguments ignored. (1277)
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
90290: No such file or directory.
Attaching to process 325239
[New LWP 325281]
[New LWP 325296]
[New LWP 325341]
[New LWP 325345]
[New LWP 325346]
[New LWP 325347]
[New LWP 325348]
[New LWP 325360]
[New LWP 325554]
[New LWP 350054]
[New LWP 359730]
[New LWP 2468705]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007fa28238bae6 in ppoll () from /usr/lib/libc.so.6
/usr/lib/../share/gcc-9.2.0/python/libstdcxx/v6/xmethods.py:731: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
  refcounts = ['_M_refcount']['_M_pi']
(gdb)
(gdb)
(gdb) continue
Continuing.
[Thread 0x7fa271931700 (LWP 325554) exited]
[Thread 0x7fa279ac8700 (LWP 325281) exited]
[Thread 0x7fa25febe700 (LWP 325345) exited]
[Thread 0x7fa25f6bd700 (LWP 325346) exited]
[Thread 0x7fa25e6bb700 (LWP 325348) exited]
[Thread 0x7fa25eebc700 (LWP 325347) exited]
[Thread 0x7fa278dc8700 (LWP 325296) exited]

Thread 1 "kwin_x11" received signal SIGSEGV, Segmentation fault.
0x00007fa27f01d39b in ?? () from /usr/lib/libKF5GlobalAccel.so.5
(gdb) bt
#0  0x00007fa27f01d39b in  () at /usr/lib/libKF5GlobalAccel.so.5
#1  0x00007fa27f0138e5 in  () at /usr/lib/libKF5GlobalAccel.so.5
#2  0x00007fa280db83be in  () at /usr/lib/libQt5Core.so.5
#3  0x00007fa280db2aa0 in QObject::destroyed(QObject*) () at /usr/lib/libQt5Core.so.5
#4  0x00007fa280db6787 in QObject::~QObject() () at /usr/lib/libQt5Core.so.5
#5  0x00007fa281814d77 in QAction::~QAction() () at /usr/lib/libQt5Widgets.so.5
#6  0x00007fa281814daa in QAction::~QAction() () at /usr/lib/libQt5Widgets.so.5
#7  0x00007fa280dacc8e in QObjectPrivate::deleteChildren() () at /usr/lib/libQt5Core.so.5
#8  0x00007fa280db6558 in QObject::~QObject() () at /usr/lib/libQt5Core.so.5
#9  0x00007fa282017d40 in  () at /usr/lib/libkwin.so.5
#10 0x00007fa280dacc8e in QObjectPrivate::deleteChildren() () at /usr/lib/libQt5Core.so.5
#11 0x00007fa280db6558 in QObject::~QObject() () at /usr/lib/libQt5Core.so.5
#12 0x00007fa278596e7a in KWin::X11StandalonePlatform::~X11StandalonePlatform() () at /usr/lib/qt/plugins/org.kde.kwin.platforms/KWinX11Platform.so
#13 0x00007fa280d77dc7 in  () at /usr/lib/libQt5Core.so.5
#14 0x00007fa280d7c455 in  () at /usr/lib/libQt5Core.so.5
#15 0x00007fa280d79779 in  () at /usr/lib/libQt5Core.so.5
#16 0x00007fa2822d5cae in __cxa_finalize () at /usr/lib/libc.so.6
#17 0x00007fa280b8b718 in  () at /usr/lib/libQt5Core.so.5
#18 0x00007ffe5ecafb60 in  ()
#19 0x00007fa2824baabb in _dl_fini () at /lib64/ld-linux-x86-64.so.2
(gdb) detach
Detaching from program: /usr/bin/kwin_x11, process 325239
[Inferior 1 (process 325239) detached]
(gdb) quit


Logs from journalctl:
Jan 28 16:53:06 jenpockej dbus-daemon[964]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.6897' (uid=1000 pid=1398 comm="/usr/lib/firefox/firefox --sm-client-id 10143c8d9d")
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:06 jenpockej systemd[1]: Starting Hostname Service...
Jan 28 16:53:06 jenpockej kwin_x11[1158]: file:///usr/share/kwin/aurorae/MenuButton.qml:22: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
Jan 28 16:53:07 jenpockej dbus-daemon[964]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 28 16:53:07 jenpockej systemd[1]: Started Hostname Service.
Jan 28 16:53:08 jenpockej sudo[403769]: pam_unix(sudo:auth): conversation failed
Jan 28 16:53:08 jenpockej sudo[403769]: pam_unix(sudo:auth): auth could not identify password for [waldauf]
Jan 28 16:53:08 jenpockej sudo[403775]: pam_unix(sudo:auth): conversation failed
Jan 28 16:53:08 jenpockej sudo[403775]: pam_unix(sudo:auth): auth could not identify password for [waldauf]
Jan 28 16:53:08 jenpockej kwin_x11[1158]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 29176, resource id: 56627913, major code: 15 (QueryTree), minor code: 0
Jan 28 16:53:08 jenpockej kwin_x11[1158]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 29181, resource id: 56627913, major code: 18 (ChangeProperty), minor code: 0
Jan 28 16:53:09 jenpockej krusader[1439]: 16:53:09.523-warning default unknown@0 # file not found (unexpected), path= "/tmp/mozilla-temp-805311980"
Comment 1 waldauf 2020-01-30 11:11:02 UTC
Upgrade qt5-base didn't help:
qt5-base (5.14.0-3 -> 5.14.1-1)
Comment 2 waldauf 2020-02-11 11:33:23 UTC
Is here anybody who can solve this problem?

My next error which I captured during restart kdeplasma:
Both point size and pixel size set. Using pixel size.
trying to show an empty dialog
QQuickItem::stackAfter: Cannot stack StatusNotifierItem_QMLTYPE_400(0x562e7b9ede60, parent=0x562e7b6bfbf0, geometry=0,0 0x0) after StatusNotifierItem_QMLTYPE_400(0x562e804fd790), which must be a sibling
QQuickItem::stackAfter: Cannot stack StatusNotifierItem_QMLTYPE_400(0x562e7bdbc090, parent=0x562e7ba28f20, geometry=0,0 0x0) after StatusNotifierItem_QMLTYPE_400(0x562e805078a0), which must be a sibling
QQuickItem::stackAfter: Cannot stack StatusNotifierItem_QMLTYPE_400(0x562e7c3e3230, parent=0x562e7bb65aa0, geometry=0,0 0x0) after StatusNotifierItem_QMLTYPE_400(0x562e805112e0), which must be a sibling
The X11 connection broke (error 1). Did the X11 server die?
KCrash: Attempting to start /usr/bin/plasmashell from kdeinit
sock_file=/run/user/1000/kdeinit5__0
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/bin/plasmashell directly
QSocketNotifier: Invalid socket 8 and type 'Read', disabling...
QSocketNotifier: Invalid socket 26 and type 'Read', disabling...
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = plasmashell path = /usr/bin pid = 196325
KCrash: Arguments: /usr/bin/plasmashell
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib/drkonqi directly
Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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.

Invalid MIT-MAGIC-COOKIE-1 keyqt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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.
Comment 3 waldauf 2020-02-12 16:22:31 UTC
The problem still persists in new the KDE version:
Operating System: Arch Linux 
KDE Plasma Version: 5.18.0
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1
Kernel Version: 5.5.2-arch2-2
OS Type: 64-bit
Comment 4 waldauf 2020-02-25 11:59:53 UTC
Hello, is there some progress? I can confirm this problem on two laptopts - Lenovo and Dell.
Comment 5 Nate Graham 2020-02-25 16:01:54 UTC
Cannot reproduce the issue. I can connect an external screen and there's no freeze.
Comment 6 David Edmundson 2020-02-26 00:37:56 UTC
I'm very confused by the original report.

Report says plasmashell is frozen
And that kwin is using max CPU

The backtrace is of kwin crashing after being closed. That doesn't seem relevant
Comment 7 waldauf 2020-02-26 09:33:29 UTC
(In reply to Nate Graham from comment #5)
> Cannot reproduce the issue. I can connect an external screen and there's no
> freeze.

What I discovered this freezing occurs when you connect two external monitors. If is there something that I can do for you (some logs, methods, ...) say me. I'd like to help to resolve this issue.
Comment 8 waldauf 2020-02-26 09:37:43 UTC
(In reply to David Edmundson from comment #6)
> I'm very confused by the original report.
> 
> Report says plasmashell is frozen
> And that kwin is using max CPU
> 
> The backtrace is of kwin crashing after being closed. That doesn't seem
> relevant

Yes, you're right. It's confusing. But I don't know what is the cause. After connecting external monitor(s) Plasma is frozen. And after some time (plus-minus) is Kwin consuming almost 100% of CPU. Sometimes is Plasma working but Kwin is consuming CPU. I don't know how to find out what is first. If you can help me I appreciate that.
Comment 9 David Edmundson 2020-02-26 11:22:01 UTC
if plasmashell is frozen, lets get a backtrace of plasmashell in the frozen state.
Comment 10 waldauf 2020-03-10 16:14:14 UTC
I need your help. I'm trying to backtrace plasmashell.

There are all processes with plasmashell:
UID          PID    PPID  C STIME TTY          TIME CMD
root        1348     868  0 17:09 ?        00:00:00 /usr/lib/sddm/sddm-helper --socket /tmp/sddm-auth2ffded24-6e47-4f4c-a2cd-b76662a96337 --id 1 --start /usr/bin/startplasma-x11 --user waldauf
waldauf     1371    1348  0 17:09 ?        00:00:00 /usr/bin/startplasma-x11
waldauf     1437    1371  0 17:09 ?        00:00:00 /usr/bin/plasma_session
waldauf     1490       1  5 17:09 ?        00:00:08 /usr/bin/plasmashell

When I run gdb I see this:
$ gdb --pid `pidof plasmashell` 2>&1 | tee kwin.gdb

GNU gdb (GDB) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 1490
ptrace: Operation not permitted.
(gdb) continue 
The program is not being run.
(gdb) 
The program is not being run.
(gdb)

What I'm doing wrong?
Comment 11 Christoph Feck 2020-03-20 17:38:26 UTC
> ptrace: Operation not permitted.

Please ask for help in a forum of your distribution how to generate a backtrace for this case. gdb should be able to attach to a running process, unless the process has already exited.
Comment 12 Bug Janitor Service 2020-04-04 04:33:10 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
mark the bug 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 13 Bug Janitor Service 2020-04-19 04:33:13 UTC
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!
Comment 14 waldauf 2020-04-20 06:31:47 UTC
In this time - due coronavirus - I'm working from my home and the problems described here I had at work. As soon as will be possible I'll retest the whole issue. If the problems will persistent I send debug information.
Comment 15 Christoph Feck 2020-04-28 06:45:04 UTC
Thanks for the update. Please set the status to REOPEN if you add new information.