Bug 431256

Summary: Shell freezes for more than 2 minutes when opening a configuration dialog
Product: [Plasma] plasmashell Reporter: Oded Arbel <oded>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED DUPLICATE    
Severity: major 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 Oded Arbel 2021-01-07 09:50:43 UTC
Using Neon unstable, but this has been happening for quite a while - at least from 5.18 - though I feel it has become worse in the last few months.

When opening any configuration dialog for the shell - such as the system tray configuration dialog, audio volume settings, desktop configuration, etc - the desktop shell freezes for more than 2 minutes - including desktop, panel, widgets, etc.

I'm running Plasma with the SystemD integration, and looking at the journal, there aren't many log messages that seem relevant, though I got quite a few messages in the form of:

Jan 06 22:12:44 vesho plasmashell[53640]: kf.package: No metadata file in the package, expected it at: "/home/odeda/Documents/Wallpapers/xxx/xxx/"

which, after reviewing I went and added metadata.desktop files to some of those directories, and as a result these messages have stopped appearing (for directories where I added new metadata files), but the freezing situation has not improved.

Still looking at the folders listed, it appears plasmashell scans my wallpaper directory structure - I have a large wallpaper collection (> 10000 images) in various directories. I ran `strace -e trace=lstat` on plasmashell, and it looks like every time a configuration dialog opens (even dialogs not related to wallpapers), plasmashell scans the path to any image that is in a folder that was ever configured as a wallpaper folder or wallpaper image. There are a few additional lstat() that I wasn't surprised to see, such as .desktop file in ~/Desktop and a couple of configuration files, but almost everything else is wallpaper image files.

Here is a snippet showing lstat usage by plasmashell for scanning **just one** such image:

----8<----
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local", {st_mode=S_IFDIR|0755, st_size=482, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share", {st_mode=S_IFDIR|0755, st_size=5326, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers", {st_mode=S_IFDIR|0775, st_size=208, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers/art-original", {st_mode=S_IFLNK|0777, st_size=54, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original/Dl7wmzRUwAAKssm.jpeg", {st_mode=S_IFREG|0664, st_size=325843, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local", {st_mode=S_IFDIR|0755, st_size=482, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share", {st_mode=S_IFDIR|0755, st_size=5326, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers", {st_mode=S_IFDIR|0775, st_size=208, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers/art-original", {st_mode=S_IFLNK|0777, st_size=54, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original/Dl7wmzRUwAAKssm.jpeg", {st_mode=S_IFREG|0664, st_size=325843, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local", {st_mode=S_IFDIR|0755, st_size=482, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share", {st_mode=S_IFDIR|0755, st_size=5326, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers", {st_mode=S_IFDIR|0775, st_size=208, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/.local/share/wallpapers/art-original", {st_mode=S_IFLNK|0777, st_size=54, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original/Dl7wmzRUwAAKssm.jpeg", {st_mode=S_IFREG|0664, st_size=325843, ...}) = 0
[pid  4478] 11:08:42 lstat("/home", {st_mode=S_IFDIR|0755, st_size=64, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda", {st_mode=S_IFDIR|0755, st_size=4960, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents", {st_mode=S_IFDIR|0755, st_size=2244, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile", {st_mode=S_IFDIR|0777, st_size=418, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media", {st_mode=S_IFDIR|0777, st_size=92, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls", {st_mode=S_IFDIR|0777, st_size=316, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art", {st_mode=S_IFDIR|0777, st_size=256, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original", {st_mode=S_IFDIR|0775, st_size=45706, ...}) = 0
[pid  4478] 11:08:42 lstat("/home/odeda/Documents/mobile/media/Walls/art/original/Dl7wmzRUwAAKssm.jpeg", {st_mode=S_IFREG|0664, st_size=325843, ...}) = 0
----8<----

This is then repeated many thousands of times.

When reviewing the full log, I think I see several different patterns of access, including a few additional catatonic patterns in child processes, and the above pattern is just one of them. I put the full log - about 400MB uncompressed - here: http://code.geek.co.il/dumps/plasmashell-journal-lstat.log.gz

BTW, I'm not really sure where the list of folders to scan comes from: the way I set up my system is that I have set up the ~/.local/share/wallpapers directory to contain symbolic links to specific themed folders in my wallpaper collection (such as Walls/art/original shown above), but not all of the folder that exist there, and indeed when looking at the lstat log - plasmashell scans just the folders linked from ~/.local/share/wallpapers. The problem is that I don't understand where plasmashell finds that configuration - it is not mentioned in ~/.config/plasma-org.kde.plasma.desktop-appletsrc, but if I open the wallpaper configuration dialog and choose "Slideshow", the folder list is pre-populated with ~/.local/share/wallpapers,/usr/share/plasma/wallpapers,/usr/share/wallpapers - which are all the directories scanned in the log - and I have no idea where it is getting that default configuration from.
Comment 1 Nate Graham 2021-03-15 16:57:03 UTC
Looks like it's the same root cause as Bug 371455.

*** This bug has been marked as a duplicate of bug 371455 ***