https://bugs.kde.org/show_bug.cgi?id=507239
Bug ID: 507239 Summary: Old inotify instances not cleaned up when changing desktop location in Folder View settings Classification: Plasma Product: plasmashell Version First 6.3.5 Reported In: Platform: Debian testing OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: Desktop icons & Folder View widget Assignee: plasma-b...@kde.org Reporter: sharks...@gmail.com CC: h...@kde.org Target Milestone: 1.0 Created attachment 183348 --> https://bugs.kde.org/attachment.cgi?id=183348&action=edit Location tab SUMMARY When changing the location of the desktop in the Folder View widget (right click on the desktop -> Desktop and Wallpaper -> Location tab), changing back to the previous location after applying does not clean up the inotify instance associated with the old directory. STEPS TO REPRODUCE 1. Navigate to the Location tab in the Desktop Folder Settings 2. Open a terminal and use the command "kde-inotify-survey" and look for the number of watches and instances under plasmashell: kunal@Kunal-deb:~$ kde-inotify-survey | grep -A 4 "plasmashell" "cmdline": "/usr/bin/plasmashell\u0000", "instances": 6, "pid": 2853529, "uid": 1000, "watches": 20 3. Change the folder to anything else (for example changing from the "Desktop folder" option (first option) to "Places panel item: Home" (3rd option) 4. Hit Apply 5. Change the folder back to what it was before and hit Apply again. 6. Rerun the command and note the number of watches: kunal@Kunal-deb:~$ kde-inotify-survey | grep -A 4 "plasmashell" "cmdline": "/usr/bin/plasmashell\u0000", "instances": 8, "pid": 2853529, "uid": 1000, "watches": 21 Continue changing the option, applying, and changing back, applying again, and notice how the number watches will permanently increment without being cleaned up: kunal@Kunal-deb:~$ kde-inotify-survey | grep -A 4 "plasmashell" "cmdline": "/usr/bin/plasmashell\u0000", "instances": 32, "pid": 2851731, "uid": 1000, "watches": 33 OBSERVED RESULT Each time the desktop location is changed and changed back, the number of watches increases by 1 and the number of instances increases by 2 for plasmashell when observing the output of kde-inotify-survey. EXPECTED RESULT Inotify instances that are no longer in use should be cleaned up instead of duplicates being created. The number of "watches" and "instances" under plasmashell in kde-inotify-survey should revert back to baseline prior to changing the folder and back. SOFTWARE/OS VERSIONS Operating System: Debian GNU/Linux 13 KDE Plasma Version: 6.3.5 KDE Frameworks Version: 6.13.0 Qt Version: 6.8.2 Kernel Version: 6.12.35+deb13-amd64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 9800X3D 8-Core Processor Memory: 60.5 GiB of RAM Graphics Processor 1: NVIDIA GeForce RTX 5080 Graphics Processor 2: AMD Radeon Graphics ADDITIONAL INFORMATION This also occurs when programmatically changing the the desktop config using DBus and executing a script (qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript), which can exhaust the inotify instance pool over time. The current workaround seems to be killing and restarting plasmashell entirely. tracing the inotify_add_watch syscall and changing the folders back and forth confirms plasmashell is not removing the old inotify instances while adding new ones: kunal@Kunal-deb:~$ sudo bpftrace -e 'tracepoint:syscalls:sys_enter_inotify_add_watch /comm == "plasmashell"/ { printf("Path: %s\n", str(args->pathname)); }' Attaching 1 probe... Path: file:///home/kunal Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: /home/kunal/Desktop/ Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: file:///home/kunal Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: /home/kunal/Desktop/ Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: file:///home/kunal Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: /home/kunal/Desktop/ Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: file:///home/kunal Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc Path: /home/kunal/Desktop/ Path: /home/kunal/.config/plasma-org.kde.plasma.desktop-appletsrc -- You are receiving this mail because: You are watching all bug changes.