Plasmashell randomly goes to 100-120% CPU

I’m struggling to even figure out what to look at to diagnose this one. I’m struggling to consistently recreate it, but I can consistently stop it. I’ve checked journalctl and I’m seeing nothing indicating an issue.

I’m not noticing any other symptoms other than plasmashell cpu going to ~100-120% CPU (kwin_wayland seems to also be about 40% when this happens). Everything seems fine, except the high usage and subsequent temperature/fan speed increase from it. Nothing is sluggish, everything works seemingly normal.

Even with everything closed, it can still happen.

The reliable way to knock it back down? Open display settings. That’s it. I don’t need to change anything, literally just opening display settings causes the CPU usage of plasmashell to drop back down into the noise. I’ve tried it with other “system settings” sections, but only “display settings” seems to reliably cause the CPU usage for plasmashell to go back down. I really hope this one bit of information I’ve been able to find can be useful, because I’m pulling my hair out trying to find a reason.

Sometimes it’ll just drop back down on its own, as randomly as it appears… But opening display settings knocks it down immediately, every time.

I cannot find any pattern to this. I thought maybe it was Firefox, but it can still happen with Firefox closed. Maybe electron? Same. Stopped/disabled baloo because maybe it was something with indexing? Nope. I can log into a fresh boot and open nothing but konsole+top, and it might be 2 minutes, it might be 15 minutes, but at some point plasmashell cpu usage will spike to 100-120% CPU usage, and I can reliably stop it by just opening “display settings”… Which, to be blunt, is really weird behavior, and I’m at a loss as to what exactly it could be.

System information: archlinux (btw), core-testing, extra-testing, kde-unstable, 5700x, 64gb ram, Linux-ck 6.7.6-1-ck-generic-v3, nvidia 3080ti w/driver version 550.54.14.

Running Wayland. Does not seem to happen on x11 in my testing.

Anyone have any thoughts on a direction to point me in? I’m kinda stuck, and I’d really appreciate a shove in a direction to get me unstuck.

It is not that common of a symptom, so we can know that there is something particular on your system.

A common culprit for plasmashell issues are non-standards plasmoids misbehaving. You can try disabling/removing the plasmoids until the symptoms disappear, that way you can identify the one that needs fixing and please report a bug.

It might be due to kdeconnect, you can try desinstalling it.

It might be related to 460348 – Plasmashell high CPU usage and 460248 – plasmashell with high CPU usage in Wayland session

An advanced technique and guaranteed to give answers, would be to use hotspot (GitHub - KDAB/hotspot: The Linux perf GUI for performance analysis. AUR (en) - hotspot). After installing debug symbols and running sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid', hotspot will allow you to pin point precisely where the hiccup come from. Launch hotspot and choose Attach to process selecting the plasmashell processus, wait until a CPU spike happens, keep this state for a second or two and stop the recording, then open the result and take a screenshot of the flamegraph tab, ideally restricting at the bottom the time frame where the CPU spike happened.
That’s one of the best techniques to investigate performance issue.

Thank you for the suggestions. The only plasmoid/widgets beyond stock stuff are system monitor stuff. The issue was there before I added those, though.

Interestingly, I didn’t notice that I haven’t reinstalled kdeconnect since I redid my system last year. Woops. Ah well, now I’m definitely gonna wait to reinstall that…

I was not familiar with hotspot and this has the (extra)gears finally unstuck. The included bug tracker links also provided a few ideas on things to try to help diagnose it, so I’ll try a few more things and report back in detail to hopefully assist others that have run into a similar issue.

I did miss an obvious diagnostic step of moving the config folder temporarily to log into a ‘clean’ environment… I’ll also try that and report back.

EDIT: I moved my .config folder and logged into a clean session. problem gone. So clearly it’s an issue with a file in the .config folder. Another note, I thought going into “display settings” was causing the CPU to go back down, but it’s right clicking on the desktop that’s stopping the CPU usage from spiking, I don’t actually have to go into the display settings. Once the right-click menu appears, CPU goes back down… So… Investigation continues.

I deleted plasmashellrc, didn’t fix it. Investigation continues. Will update as I find moar.

2nd EDIT: config folder deleting was a red herring… i guess i didnt test long enough, because i did it again and it’s back to spiking. Well, there goes that easy fix I guess.

I can’t be entirely certain which fixed it, but I had some environment variables that disabling seemed to resolve my issue(s)*. The ones I’ve disabled are QT_X11_NO_MITSHM=1, QT_QPA_PLATFORM=wayland-egl, NVD_BACKEND=direct

These were originally added to fix other issues/enable other features, and don’t seem to be necessary anymore. On the contrary, it appears one or more of these were outright causing problems.

*Other annoyances are also magically gone (clipboard seems to actually work more than half the time now, drag/drop into discord works, drag/drop into tk isn’t a coin toss, etc)… so… yeah… I earned my dunce cap.