Bug 340294 - kwin_x11 sometimes goes up to 100% cpu usage and freezes the system
Summary: kwin_x11 sometimes goes up to 100% cpu usage and freezes the system
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.1.0
Platform: Kubuntu Linux
: VHI major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 343260 343374 343819 344367 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-24 10:36 UTC by Gandalf Lechner
Modified: 2016-09-09 22:52 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
KWin support information (4.74 KB, text/plain)
2014-10-30 10:11 UTC, Gandalf Lechner
Details
KWin stack trace while process is at 100% CPU (22.75 KB, text/x-log)
2015-01-21 19:37 UTC, Cristian Oneț
Details
The switcher I use (127.73 KB, image/png)
2015-01-21 19:52 UTC, Cristian Oneț
Details
I was using the "Breeze" switcher (183.66 KB, image/png)
2015-01-22 05:26 UTC, Cristian Oneț
Details
Another gdb stack trace (11.59 KB, text/plain)
2015-01-22 06:11 UTC, Cristian Oneț
Details
WindowSwitcher.qml with width depending on scrollbar visability (6.16 KB, text/plain)
2015-01-25 21:32 UTC, Thomas Lübking
Details
kwin_x11 stacktrace when cpu usage is high and visual artefacts are showing (66.94 KB, text/plain)
2015-08-14 16:07 UTC, Pavel Gurevich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gandalf Lechner 2014-10-24 10:36:25 UTC
Unfortunately I can not specify under which circumstances it happens. It appears somewhat random to me, sometimes it happens every few minutes (without any specific activity on my side), sometimes only after an hour. My system is the Dell XPS13 Ubuntu Laptop.

Reproducible: Sometimes
Comment 1 Martin Flöser 2014-10-24 11:18:40 UTC
please try to attach gdb to it when it happens and generate a backtrace.
Comment 2 Thomas Lübking 2014-10-24 12:49:51 UTC
please also attach the output of
   qdbus org.kde.KWin /KWin supportInformation

also see bug #338355 (is it related to adding a window, inc. even tooltips and such?)
Comment 3 Gandalf Lechner 2014-10-30 10:10:55 UTC
Below I attach the kwin support info. I don't know how to use gdb, or what to do to obtain a useful bug report when the system is frozen. Any hint appreciated. It seems not to be related to adding windows etc, it appears random to me.
Comment 4 Gandalf Lechner 2014-10-30 10:11:41 UTC
Created attachment 89373 [details]
KWin support information
Comment 5 Thomas Lübking 2014-10-30 12:38:42 UTC
what's the output of "grep -i glamor /var/log/Xorg.0.log"?

On gdb:

[press Ctrl+Alt+F1]
[login]
# this will allow you to attach gdb to kwin
$ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
# run gdb, log to "kwin.gdb"
$  gdb --pid `pidof kwin` 2>&1 | tee kwin.gdb
# you're not in the gdb promt ">"
> bt
[enter, enter, enter, ... until there's no more output]
> detach
> quit
$ exit
[press Ctrl+Alt+F7]
Comment 6 Martin Flöser 2015-01-07 10:24:36 UTC
without the requested output we won't be able to investigate this.
Comment 7 Gandalf Lechner 2015-01-12 16:30:30 UTC
(In reply to Martin Gräßlin from comment #6)
> without the requested output we won't be able to investigate this.

Unfortunately, I switched back to plasma 4, so that I cannot provide further reports on this.
Comment 8 Martin Flöser 2015-01-13 07:31:03 UTC
thanks for getting back to us. That's totally fine to switch back to 4.x :-)

I'll change to WORKSFORME as that's what it is at the moment. If you switch to 5.x again and still are experiencing this problem, please reopen.
Comment 9 Cristian Oneț 2015-01-21 19:36:24 UTC
I'm using a Plasma 5 desktop compiled from sources (as a side note: for KMyMoney frameworks development) and I encountered this kwin issue, as I remember, several times after pressing Alt+Tab. Today, after building the sources, I've started the session again and it happened while working and using Alt+Tab. Plasma became unusable so I switched to a VT and attached with gdb to obtain a stack trace. I'll attach it to this report. I'll also reopen the issue to reflect this new information.
Comment 10 Cristian Oneț 2015-01-21 19:37:31 UTC
Created attachment 90567 [details]
KWin stack trace while process is at 100% CPU

As promised, this is the stack trace obtained using gdb.
Comment 11 Thomas Lübking 2015-01-21 19:46:24 UTC
hard to say from one trace for sure, but looks like a recursive gepmetry update in QtQuick.
Which switcher style do you use?
Comment 12 Cristian Oneț 2015-01-21 19:52:12 UTC
Created attachment 90568 [details]
The switcher I use

This is the switcher I use, let me know if I can get more data than the stack trace next time this happens.
Comment 13 Thomas Lübking 2015-01-21 22:55:48 UTC
Can you please look up the actual name in "kcmshell5 kwintabbox"?
(It looks like "Thumbnails" but there're alternative variants to this)
Comment 14 Cristian Oneț 2015-01-22 05:26:30 UTC
Created attachment 90572 [details]
I was using the "Breeze" switcher

Actually I just realized that killing kwin and restarting it by hand changed the window decorations to oxygen and the window switcher, so forget the previous screenshot, this is what Plasma was using by default. It's the "Breeze" switcher, I just realized this after logging back into the Plasma 5 session.
Comment 15 Cristian Oneț 2015-01-22 06:11:03 UTC
Created attachment 90573 [details]
Another gdb stack trace

This happened again today.
Comment 16 Thomas Lübking 2015-01-22 12:52:44 UTC
From the second trace and a brief look at the qml, i'd say that Plasma.ScrollArea cannot decide whether it wants a scrollbar or not.

What would happen is that the list has a height just a little larger than then scrollarea, the area adds a scrollbar. In return the available width and thus all items (with somewhat fixed aspect) shrink. As a result the list is shorter than the scrollarea. The scrollbar is not required and removed. More width, so the icons grow ...

Adding Marco.
Autohiding scrollbars are recursion prone and this needs at least a decision where to be fixed (ie. how idiot-proof PlasmaExtras.ScrollArea is supposed to be)

Also: do we need a PlasmaExtras.ScrollArea (ie. scrollbars) here at all??
Comment 17 Cristian Oneț 2015-01-22 13:08:52 UTC
I'm glad that the second trace provided more information :).
Comment 18 Nick Shaforostoff 2015-01-25 02:46:46 UTC
*** Bug 343260 has been marked as a duplicate of this bug. ***
Comment 19 Nick Shaforostoff 2015-01-25 02:48:36 UTC
hey. bug 343260 has much longer backtraces of kwin and kded, with over 200 calls on the stack )))
Comment 20 Nick Shaforostoff 2015-01-25 02:53:30 UTC
scrollbars would be redundant, because the switching is done by keyboard and not the mouse.
Comment 21 Thomas Lübking 2015-01-25 21:31:55 UTC
(In reply to Nick Shaforostoff from comment #20)
> scrollbars would be redundant, because the switching is done by keyboard and
> not the mouse.

I assume it's to indicate the padding.

Can you try to replace it with the attached file?
Should go somewhere like
usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/windowswitcher/WindowSwitcher.qml
Comment 22 Thomas Lübking 2015-01-25 21:32:51 UTC
Created attachment 90656 [details]
WindowSwitcher.qml with width depending on scrollbar visability
Comment 23 Nick Shaforostoff 2015-01-26 00:40:12 UTC
yes, this fixes the issue. but still, the scrollbar is visually a redundant detail for me.
Comment 24 Nick Shaforostoff 2015-01-26 00:42:03 UTC
for example on osx scrollbars are becoming visible only while mouse cursor is close to the right or bottom window edge
Comment 25 Thomas Lübking 2015-01-26 16:25:09 UTC
Consulting HIG ;-)

@Thomas P.
Please ignore the scary backtraces.
The opened question is whether the window switcher should indicate the oversupply of windows (by showing a scrollbar)
Comment 26 Thomas Pfeiffer 2015-01-26 22:05:29 UTC
Having some kind of indicator of
a) The fact that there are more windows than are being shown in the list
b) Which section of the overall list is currently visible
is important here because if we don't show any indication, users will wonder where those other windows are gone.

The scrollbar has the advantage that it's well known, but if its technical problems can't be solved on the technical level, it's okay to use a different indicator for the above two kinds of information.
Comment 27 Nick Shaforostoff 2015-01-26 23:21:27 UTC
a nicer looking indicator would be small arrows on the bottom and top of the vertical bar
Comment 28 Nick Shaforostoff 2015-01-26 23:56:02 UTC
Git commit 116b1d170eb25b957a3c0f3d21b429afc3f88d6a by Nick Shaforostoff.
Committed on 27/01/2015 at 01:53.
Pushed by shaforo into branch 'master'.

fix total system freeze on some systems like my 10 inch netbook
thanks Thomas Lübking for providing the patch

M  +2    -1    lookandfeel/contents/windowswitcher/WindowSwitcher.qml

http://commits.kde.org/plasma-workspace/116b1d170eb25b957a3c0f3d21b429afc3f88d6a
Comment 29 Thomas Lübking 2015-01-27 16:00:14 UTC
*** Bug 343374 has been marked as a duplicate of this bug. ***
Comment 30 Thomas Lübking 2015-02-05 15:15:52 UTC
Nick, did you also chery-pick that for 5.2?
Comment 31 Nick Shaforostoff 2015-02-05 16:53:25 UTC
i will do it later this evening
Comment 32 Nick Shaforostoff 2015-02-05 19:56:05 UTC
Git commit 30c0bcd017f2f5db2f0578e06c095b54e156422b by Nick Shaforostoff.
Committed on 27/01/2015 at 01:53.
Pushed by shaforo into branch 'Plasma/5.2'.

fix total system freeze on some systems like my 10 inch netbook
thanks Thomas Lübking for providing the patch

M  +2    -1    lookandfeel/contents/windowswitcher/WindowSwitcher.qml

http://commits.kde.org/plasma-workspace/30c0bcd017f2f5db2f0578e06c095b54e156422b
Comment 33 Thomas Lübking 2015-02-06 15:55:21 UTC
*** Bug 343819 has been marked as a duplicate of this bug. ***
Comment 34 Thomas Lübking 2015-02-23 12:55:04 UTC
*** Bug 344367 has been marked as a duplicate of this bug. ***
Comment 35 Pavel Gurevich 2015-08-14 16:07:11 UTC
Created attachment 94040 [details]
kwin_x11 stacktrace when cpu usage is high and visual artefacts are showing

Stack trace of kwin_x11 taken when high CPU usage and visual artefacts are observed.
Comment 36 Pavel Gurevich 2015-08-14 16:08:26 UTC
I seem to observe the same behavior with AMD fglrx driver on R9 280X.
OpenSuSE 13.2, KF5 5.3.95
Comment 37 Thomas Lübking 2015-08-14 16:35:26 UTC
completely unrelated.

the aurorae decoration, or rather qtquick, triggers a framebuffer read and that stirs up something deep in fglrx.

switch to the breeze decoration, but the problem will be either in  qtquick or fglrx.
Comment 38 Pavel Gurevich 2015-08-15 12:32:54 UTC
You're probably right, the problem might be in fglrx, as switching to breeze didn't help. I'll try restart later, check if that would help.

I want to try to switch to open-source driver for R9 280x. Does somebody know about major issues of doing so?
Comment 39 dag 2015-12-15 00:01:44 UTC
kwin_x11 constantly uses 100% CPU for the other users when using multi login <Ctrl-Alt-Fn>. That is A logged in to F7, B logged in to F8 and C logged in through F9. When A is using the system B's and C's kwin_x11 uses 100% CPU. When B is using the system A's and C's CPU usage is at 100% and so on.
Comment 40 Thomas Lübking 2015-12-15 08:41:55 UTC
Completely unrelated to this bug, the driver waits for a vblank signal that never occurs, suspend the compositor on the inactive VTs.

See bug #328122 or bug #330954
Comment 41 SmOkPl 2016-09-09 22:52:57 UTC
I confirm, I use multilogon and unused logon user use 100% cpu kwin_x11. 
Plasma 5.7.4, (S 5.25.0), QT 5.7.0