Bug 341674 - High CPU load when using second panel in multiscreen setup
Summary: High CPU load when using second panel in multiscreen setup
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-multiscreen (show other bugs)
Version: master
Platform: Exherbo Linux
: NOR normal
Target Milestone: 1.0
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-08 21:05 UTC by Bernd Steinhauser
Modified: 2016-04-14 21:48 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
perf.data (77.49 KB, application/octet-stream)
2014-12-12 16:34 UTC, Bernd Steinhauser
Details
perf.data with cpu usage of 50-70% (74.27 KB, application/octet-stream)
2014-12-13 08:33 UTC, Bernd Steinhauser
Details
top screen capture (86.55 KB, image/png)
2015-05-07 16:02 UTC, Eric Atkin
Details
perf record -p `plasmashell pid` (3.11 MB, application/octet-stream)
2015-05-07 16:03 UTC, Eric Atkin
Details
crash with panel on each screen after 1.5 days (14.26 KB, text/plain)
2015-08-10 20:40 UTC, Bernd Steinhauser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Steinhauser 2014-12-08 21:05:11 UTC
This is a regression, but I can't exactly tell when it started to appear. Maybe somewhere around October.

Basically, when using a multiscreen layout and adding an empty or default panel to the second (and maybe third) screen, plasmashell will pick up cpu load slightly and after a while (~3-5h) will increase further until using 100% of one cpu core. plasmashell will still work, but is starting to show laggy behaviour. When killing and restarting plasmashell, everything is fine again.

When using a multiscreen setup with only a panel on one of the screens (only tested the primary screen, though), this does not happen.
Also, this was not the case with Plasma 5.0.
Took me some time to find the origin within the additional panel, but I'm now confident, that it is caused by adding the panel (with or without widgets).

Reproducible: Always

Steps to Reproduce:
1. Setup a multiscreen
2. Add an empty panel to the second screen
3. Wait a couple of hours

Actual Results:  
After 3h, plasmashell might use something like 20% of one core's time continuously. After ~8-9h, plasmashell might use 100% of one core's time.

Expected Results:  
Non-continuous cpu usage.

I found this to happen with and without desktop effects, but didn't really try without effects lately.

KF5 is at recent git master.
Comment 1 David Edmundson 2014-12-10 23:25:18 UTC
I can't reproduce here, I'm afraid I need a bit more data to go on.

Could you run:
perf record -g plasmashell

and attach the output perf.data file.
Comment 2 Bernd Steinhauser 2014-12-12 16:34:35 UTC
Created attachment 89940 [details]
perf.data

It seems to be better at the moment, but still cpu load is significantly higher when using two panels.

Anyway, with the current load level, I created the perf.data file.
Comment 3 David Edmundson 2014-12-12 16:49:40 UTC
Thanks.
Comment 4 Bernd Steinhauser 2014-12-13 08:33:22 UTC
Created attachment 89951 [details]
perf.data with cpu usage of 50-70%

CPU usage did rise again, I took a sample at a rather high load. plasmashell was starting to behave laggy.

After removing the second panel, load dropped instantly, although not instantly to 0%, but 20%.
After a few minutes, load was practically at 0%, when doing nothing.

(percentage for one of four CPUs)
Comment 5 Bernd Steinhauser 2015-01-01 17:06:56 UTC
Ok, I updated to a recent Plasma stack and the situation seems somewhat improved. I also noticed a couple of things.

First, the perf.data files above aren't really useful, since -g plasmashell just starts the process and takes a few snaps, but the problem isn't present from the start.
Second, the situation changed a little bit and I'm no really convinced anymore, that it is actually triggered by the second panel, instead, I think the second panel in some way just supports this kind of behaviour.
I noticed, that the CPU usage (for the plasmashell process) goes up especially when playing some kind of video, be it i.e. a video on Youtube or a video file by vlc. In such a case, a high CPU load might be espected and is happening for X11 (if using the xv video output like I do), vlc (decoding the video) and maybe for kwin (which renderrs). However, I don't understand why plasmashell would need a high CPU usage. First I thought it might be the thumbnails in the task manager, but I disabled those and it is still happening.
Second, when closing the video, CPU usage sometimes goes down, sometimes stays up at least for a while.

Using perf record -p plasmashell_pid I let perf hook up to the process and it shows that it's spending:
59.87% - poll_freewait (Command plasmashell)
29.28% - do_raw_spin_trylock (Command QXcbEventReader)

I'll delete the attachments, as I doubt they are useful, if it would be interesting, I can upload a new one that I took with the -p pid method.
Comment 6 JKAbrams 2015-03-29 05:24:58 UTC
I've got a similar problem, not sure what it is related to, but I do have two panels (one on each screen).
Without fail, after a few hours plasamashell starts using 25% CPU (one core at 100%).
Comment 7 Eric Atkin 2015-05-07 16:02:00 UTC
Created attachment 92481 [details]
top screen capture
Comment 8 Eric Atkin 2015-05-07 16:03:29 UTC
Created attachment 92482 [details]
perf record -p `plasmashell pid`
Comment 9 Eric Atkin 2015-05-07 16:09:18 UTC
I'm seeing similar symptom. The system is fine after a fresh reboot, but several hours later, the plasmashell process is taking a significant portion of cpu time. I've attached a `top` screenshot. Notice the utilization isn't pegged to one cores. It's spread out over all the cores and and split between user and system. I've also attached a perf.data file. Looks like lots of malloc and free.

My system is an ASRock Z87 Extreme9/ac motherboard with 2x thunderbolt ports and 1x HMDI. I've got all three hooked up and using the intgrated intel graphics on the cpu.

I'm running Arch linux. I'm not sure what packages are relevant, but here are a few that seemed relevant:

local/plasma-desktop 5.3.0-2
local/plasma-framework 5.9.0-1
local/plasma-workspace 5.3.0-1
local/linux 4.0.1-1
local/mesa 10.5.4-1
local/xf86-video-intel 2.99.917-5

Please let me know if there is any other info that could be helpful.
Comment 10 Eric Atkin 2015-05-07 16:12:23 UTC
FYI, it doesn't seem to be related to panels on the 2nd and 3rd screen. If I remove the panels on those screens, the high utilization persists.
Comment 11 fantaz 2015-05-08 10:09:11 UTC
I'm experiencing the same problem, both with plasma 5.2.2 on kubuntu 15.04 and 5.3 after update. Please let me know if there is anything I can help you with.
Comment 12 Bernd Steinhauser 2015-05-09 09:10:27 UTC
@Eric: How many panels do you have on each screen.

@fantaz: For one, it would be helpful to know if you have more than one panel on each screen, what happens if you remove one of them.

Also, are you using symmetrical setups with identical screens? Where are the panels? Top, Bottom, Side...

I don't think, that the panel is the issue for me, it's just triggering a bug, but that's not a given. Although I have to say, that I didn't test this in the last 2-3 months as it was so annoying, so I am just using one panel on one screen nowadays (which is annoying as well, but not as annoying as a lagging system).
Comment 13 fantaz 2015-05-09 19:07:05 UTC
(In reply to Bernd Steinhauser from comment #12)
> @fantaz: For one, it would be helpful to know if you have more than one
> panel on each screen, what happens if you remove one of them.
I have one default panel per screen located at the bottom of each screen. Additionally, each panel's height is increased compared to default values. I had enabled for firefox and dolphin "Show a launcher when not running" option on each panel, which results in somewhat strange behavior. Meaning, If I launch dolphin on one screen, sometimes the launcher on other screen does not display dolphin icon, but rather busy icon (animated circle). One can click on that and still get another dolphin instance. Considering screens: They are different and (17'' and 19'') but have the same resolution, though.
As for the request: I'm not able to test your request but will in a day or two.
hope this helps a bit.
Comment 14 fantaz 2015-05-12 14:55:06 UTC
(In reply to fantaz from comment #13)
> (In reply to Bernd Steinhauser from comment #12)
> > @fantaz: For one, it would be helpful to know if you have more than one
> > panel on each screen, what happens if you remove one of them.
High CPU usage is gone, but plasmashell's memory usage skyrockets from ~180 MB to well over 2GB after all day's work. It grows slowly with every action: show volume constrol, display network connectio, show application launcher, etc.
hope it helps a bit
Comment 15 Eric Atkin 2015-05-18 21:40:36 UTC
HDMI1 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 475mm x 267mm
HDMI2 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 475mm x 267mm
HDMI3 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 475mm x 267mm

I have one panel per screen, all on the top edge. HDMI1 has several widgets on the panel as it is the center and primary screen. The other two have only have task manager widgets.

The panels don't seem to be the trigger for me. I see the symptoms even if I remove the panels from HDMI2 and 3, but if disable those two outputs, (ie. only using HDMI1) then no symptoms.
Comment 16 JKAbrams 2015-05-18 22:18:31 UTC
My setup is two screens of same make/model set to the same resolution.
Two panels, one on the bottom of each screen.
I'm using Xrender as opengl based compositing started to fail self tests in a recent update:
Pixel was QVector4D(0, 0, 0, 0) expected QVector4D(0, 1, 0, 1)
kwin_core: ShaderManager self test failed
kwin_core: Failed to initialize compositing, compositing disabled

Most actions increases the memory footprint of plasmashell, about 200-900KiB per click on volume/notifications/network start menu etc, this memory is never recovered.
CPU usage is very high for every action on the panels, like just hovering over the items in the taskbar gives about 50% CPU usage according System Monitor CPU History Graph

I also see various layout errors with margins on the panels. The height of the taskbar items is too low, and it is lower on the right screen then then left. Sometimes tray icons find themselves under the clock on the left screen (main screen).
The three lines on the desktop plasma menu used to be off too far to the right/down, but seems to work now.
Switching between the different compositing modes will affect these layout problems in various ways.

After 1 hour plasmashell now uses 345MiB memory, this will keep increasing. Sometimes by a lot, I've found it at 2GiB a few times. Killing plasmashell and starting it again gets the memory down to 234MiB.

I managed to crash plasmashell by clicking on the notification icon a few times in fast succession.

I see a lot of these:
XcbConnection: XCB error: 9 (BadDrawable), sequence: 38988, resource id: 0, major code: 14 (GetGeometry), minor code: 0
Comment 17 JKAbrams 2015-05-18 22:24:48 UTC
I'm using the nouveau driver with a Geeforce 8800GT card.
KDE 5.10 on Arch.
plasma-desktop 5.3
plasma-framework 5.10

And I should add for clarity, when I say hover over the taskbar, I mean moving the mouse over the taskbar items so the animation is displayed this is an expensive operation CPU-wise (any way to turn the animation off?).
Comment 18 brainout 2015-06-17 15:59:04 UTC
Just to add to the discussion:  I had the same problem using a Xeon quad core (maybe 7 years old?), where 50% of the CPU was being used and that surprised me.  All I had to do was turn off animation in Application Appearance, Icons, Advanced tab and the CPU immediately went down to 4%.  The system is otherwise idle, just after boot, no other applications loaded.

I should mention I'm using PCLinuxOS in 32 bit with its 6 native desktops, and am using SlideShow of my Pictures folder (many), with 1600x900 or FHD resolution being 'typical', and on this machine I have Nvidia.  Machine is HP 6400.  I have over 18 machines which run Windows, non-networked. (I use Linux solely on external drives or sticks for managing the Win machine's files, etc.) So can report varying configurations and processors, if you like.  All the machines are 2 years old or more.
Comment 19 brainout 2015-06-17 16:00:24 UTC
(In reply to brainout from comment #18)
> Just to add to the discussion:  I had the same problem using a Xeon quad
> core (maybe 7 years old?), where 50% of the CPU was being used and that
> surprised me.  All I had to do was turn off animation in Application
> Appearance, Icons, Advanced tab and the CPU immediately went down to 4%. 
> The system is otherwise idle, just after boot, no other applications loaded.
> 
> I should mention I'm using PCLinuxOS in 32 bit with its 6 native desktops,
> and am using SlideShow of my Pictures folder (many), with 1600x900 or FHD
> resolution being 'typical', and on this machine I have Nvidia.  Machine is
> HP 6400.  I have over 18 machines which run Windows, non-networked. (I use
> Linux solely on external drives or sticks for managing the Win machine's
> files, etc.) So can report varying configurations and processors, if you
> like.  All the machines are 2 years old or more.

OH: and the default Full Monty KDE panel per desktop (total of 6).
Comment 20 brainout 2015-06-17 16:53:10 UTC
(In reply to brainout from comment #19)
> (In reply to brainout from comment #18)
> > Just to add to the discussion:  I had the same problem using a Xeon quad
> > core (maybe 7 years old?), where 50% of the CPU was being used and that
> > surprised me.  All I had to do was turn off animation in Application
> > Appearance, Icons, Advanced tab and the CPU immediately went down to 4%. 
> > The system is otherwise idle, just after boot, no other applications loaded.
> > 
> > I should mention I'm using PCLinuxOS in 32 bit with its 6 native desktops,
> > and am using SlideShow of my Pictures folder (many), with 1600x900 or FHD
> > resolution being 'typical', and on this machine I have Nvidia.  Machine is
> > HP 6400.  I have over 18 machines which run Windows, non-networked. (I use
> > Linux solely on external drives or sticks for managing the Win machine's
> > files, etc.) So can report varying configurations and processors, if you
> > like.  All the machines are 2 years old or more.
> 
> OH: and the default Full Monty KDE panel per desktop (total of 6).

One more relevant fact: I already had all other effects turned off, so still had the high CPU despite that.  Also settings are in Application Appearance, Style Fine Tuning Tab: Low Reso and Low CPU (sounds good, I've no idea what it means);  Desktop Effects Advanced Tab uses OpenGL2.0 Composting and Raster for graphics.  Workspace Behavior set to 'Do Not Remember' didn't alter anything, but if the problem is CPU usage with time in session, seems like that option should be selected.
Comment 21 Bernd Steinhauser 2015-08-10 20:26:37 UTC
(In reply to brainout from comment #20)
I had a look at this and I can't reproduce your observations. Especially I don't have the options you noted or they are named differently. Are you actually running the KF5-based plasmashell or are you running KDE4?
IIRC (has been some time), the options you name are from KDE4 or from some quite old version of KF5-based plasma-workspace.

Anyway, deactivating those animations and anything that I could find and could be performance-related didn't help at all.
It's still happening as described above. I also noted, that the clock fails to update after some time, so it stands still at a specific time and only updates if something on the panel is activated, i.e. a window from the task manager (if the panel gets the focus?).
Comment 22 Bernd Steinhauser 2015-08-10 20:34:28 UTC
Also, I just had a segfault most likely related to this. Will upload related info in a second.
Comment 23 Bernd Steinhauser 2015-08-10 20:40:26 UTC
Created attachment 93977 [details]
crash with panel on each screen after 1.5 days

This is the output I could find in the journal about the crash that happened today. I suspect it is related to this, because I was doing a testrun to see if I can still reproduce this bug.

At the time of the crash the panel was already lagging severely and only updating if it was clicked (Click-To-Focus is set).
plasmashell was consuming approx 10% of the CPU time continuously. Normally, the CPU usage of plasmashell on this system is much lower.
Comment 24 Bernd Steinhauser 2015-08-10 20:42:29 UTC
I wanted to add, that this was the first crash I had with plasma-workspace for approx. 4-5 months, so obviously I can't be sure that it is related to this bug, but I think it's a fair assumption.
Comment 25 David Edmundson 2015-08-11 09:34:09 UTC
Bernd, no that crash is in some database code. Probably KActivities.
Comment 26 Bernd Steinhauser 2015-08-11 15:01:23 UTC
Comment on attachment 93977 [details]
crash with panel on each screen after 1.5 days

Ok, marked obsolete.
Comment 27 Mathieu MD 2015-08-14 11:47:52 UTC
Since I upgraded my Debian Jessie to Stretch, moving from KDE 4 to 5, I too had plasmashell consuming around 100% of one of the 3 cores of my machine.

Removing the widget "network monitoring" (the one showing a usage graph of each network interfaces) from one of the panels instantly solved the problem, the CPU% falling to 1 or 2%. Adding this widget back instantly raise the CPU% to 75%!

Info:
- Dual-screen with a panel on both screens.
- plasma-workspace version 5.3.2-4
- Debian 8 Stretch
Comment 28 Bernd Steinhauser 2015-08-14 14:05:03 UTC
(In reply to Mathieu MD from comment #27)
> Since I upgraded my Debian Jessie to Stretch, moving from KDE 4 to 5, I too
> had plasmashell consuming around 100% of one of the 3 cores of my machine.
> 
> Removing the widget "network monitoring" (the one showing a usage graph of
> each network interfaces) from one of the panels instantly solved the
> problem, the CPU% falling to 1 or 2%. Adding this widget back instantly
> raise the CPU% to 75%!
I can confirm your observation. However, this is unrelated to this bug, as this happens with only a single panel as well. Therefore, I suggest you open another bug.

As for this bug: It happens even when adding an empty panel (at least last time it did, will try again). So it's unlikely, that it is related to a specific widget.
Comment 29 Bernd Steinhauser 2016-02-19 16:23:13 UTC
Retested with 5.5.5 and things look much better now. CPU load is still a tad higher with multiple panels, but it doesn't raise over time and doesn't consume 100% of a cpu core. Thus closing with worksforme.