Bug 501749

Summary: plasmashell hangs on system start with high disk usage
Product: [Plasma] plasmashell Reporter: joway21271
Component: generic-performanceAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: kde, nate
Priority: NOR    
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description joway21271 2025-03-19 15:41:52 UTC
SUMMARY

Most likely plasmashell gets stuck in some kind of loop related to audio on startup. As a result it becomes extremely unresponsive and constantly tries to interact with the drive causing high disk and cpu usage until it finally unstucks itself after some random amount of time.

This doesn't happen every time and the time it takes to unstuck itself is random too. I'm not sure what exactly triggers it but it seems that it's more prone to this behaviour after kernel updates.

Some entries from KSystemLog make me believe it's somehow related to audio. Note that I don't see those lines in log every time, I believe those are the related lines from plasamashell that I observed last time it happened:

org.kde.pulseaudio: Giving up after 5 tries to connect
org.kde.pulseaudio: context kaput

And here's the only thing about audio from this boot since it happened again (not sure if this one at all related):

org.kde.pulseaudio: server_cb() called without info!

The rest of the log from plasmashell looks unrelated. One more thing pointing to it being audio related is audio widget in plasmashell itself. After it gets unstuck it's usually crossed out as if there are no audio devices connected and displays a message stating that it failed to connect to audio service with retry button that brings all devices back when pressed.

STEPS TO REPRODUCE
1. Boot the system.

OBSERVED RESULT

Plasmashell becomes unresponsive with high disk and cpu usage. 

EXPECTED RESULT

Plasmashell doesn't become unresponsive.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.13.7-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700X3D 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3080 Ti

ADDITIONAL INFORMATION

Since it probably related to audio somehow, I'm using pipewire with wireplumber but this behaviour also happens with pipewire-media-session or whatever the default thing is called. 

I can provide more info if needed but I'm not sure where to look to understand what causes it. The only workaround I managed to find is to endlessly kill plasmashell process until it doesn't get stuck or just waiting it out before it times out or whatever happens there.
Comment 1 Nate Graham 2025-03-19 20:40:55 UTC
Does this happen in a new clean user account as well? Or only in your normal user account?
Comment 2 joway21271 2025-03-19 23:49:33 UTC
I've created a new account and I think you are right, it doesn't seem to happen there. What are my next steps would be to determine the problem with my original account?
Comment 3 Nate Graham 2025-03-21 17:04:55 UTC
Two options:
1. Go back to your normal user account and undo any customizations you made to it one at a time until you find out which one caused it.
2. In the new user account, replicate the customizations you made to your normal user account one at a time until you find out which one caused it.
Comment 4 joway21271 2025-03-21 17:41:51 UTC
(In reply to Nate Graham from comment #3)
> Two options:
> 1. Go back to your normal user account and undo any customizations you made
> to it one at a time until you find out which one caused it.
> 2. In the new user account, replicate the customizations you made to your
> normal user account one at a time until you find out which one caused it.

The problem is I don't really have any complicated customization. Floating panel, Weather Widget (bug happens with or without it) and some txt files on my desktop. I can't think of anything else. What configuration file(s) can I purge that relate to plasmashell? 
plasma-org.kde.plasma.desktop-appletsrc? Anything else?
Comment 5 joway21271 2025-03-24 13:38:41 UTC
Removing plasma-org.kde.plasma.desktop-appletsrc didn't help, issues still happens.
Comment 6 Nate Graham 2025-03-25 22:17:58 UTC
At this point I think it would be best if you asked your distro to help debug it, if you aren't able to pinpoint it yourself.
Comment 7 joway21271 2025-04-10 00:02:03 UTC
So, since I was not sure which config file is broken I went and bisected whole .config folder until I found the culprit. The problematic file was kactivitymanagerdrc. As far as I can tell it simply has a hash and a name of the activity. I assume something is wrong with the original activity then. The only things that changed with this newly generated file are the positions of text files on my desktop, sticky note dissaperance and different wallpaper. I assume all those things are saved in this original activity. I truly have no idea how any of these can lead to the behaviour described in this bug report. 

Are those settings saved in sqlite db here? .local/share/kactivitymanagerd 

I'll try to dig deeper later to understand the root cause of this. I wonder if simple sticky note can cause such strange results.
Comment 8 joway21271 2025-04-10 11:48:31 UTC
Alright, so sticky note and other things I listed have nothing to do with this. appletsrc file was overwritten somehow, they are not related to kactivitymanagerd. 

Opening the kactivitymanagerd database I can see that it has around 1 mln entries for ResourceScoreCache and ResourceEvent tables combined. 

I figured all of those are recent files history. Checked the settings and it has keep history forever. I guess plasmashell was querying all of those entries on start ocasionally. Not sure if it's default on storing them forever or I changed it myself somehow and forgot about it. Cleared the history and set it to 1 month. Hope this doesn't come back and maybe it helps someone else.