https://bugs.kde.org/show_bug.cgi?id=429593

--- Comment #55 from Kevin Coonan <[email protected]> ---
# Testing...
```bash
        PLASMA=$(pgrep -u me -xo plasmashell)
        KWIN=$(pgrep -u me -xo kwin_wayland)
        perf record \
        -o /tmp/file-missing.data \
        -e ksycoca:file_missing \
        -p "$PLASMA,$KWIN" \
        -- sleep 10
        perf script -i /tmp/file-missing.data | grep 'ksycoca:file_missing'
```

## Results-->

Problem is probably localized to:
```c++
if (!fi.exists()) {
    return false;
}
```
`
  kwin_wayland    6954 [006] 43712.805426: ksycoca:file_missing: (7f9657a675f4)
     plasmashell   35083 [003] 43713.617139: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43714.329498: ksycoca:file_missing:
(7f9657a675f4)
     plasmashell   35083 [001] 43715.141720: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43715.836892: ksycoca:file_missing:
(7f9657a675f4)
     plasmashell   35083 [005] 43716.649151: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43717.344287: ksycoca:file_missing:
(7f9657a675f4)
     plasmashell   35083 [002] 43718.151947: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43718.960185: ksycoca:file_missing:
(7f9657a675f4)
     plasmashell   35083 [002] 43719.723281: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43720.470552: ksycoca:file_missing:
(7f9657a675f4)
     plasmashell   35083 [003] 43721.233862: ksycoca:file_missing:
(7f9d3b9b25f4)
    kwin_wayland    6954 [008] 43722.043224: ksycoca:file_missing:
(7f9657a675f4)
`
## A test is ordered...
```bash
timeout 3s strace -f \
  -p "$PLASMA" -p "$KWIN" \
  -e trace=newfstatat,statx \
  -e status=failed \
  -s 512 \
  -o /tmp/ksycoca-missing.strace


grep -F 'mimeapps.list' /tmp/ksycoca-missing.strace
```
### ...and a diagnosis made (sort of)
>6954  statx(AT_FDCWD, "/usr/local/share/applications/kde-mimeapps.list", 
>AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffccea14600) = -1 EACCES 
>(Permission denied)
6954  statx(AT_FDCWD, "/usr/local/share/applications/mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffccea14600) = -1 EACCES
(Permission denied)
6954  statx(AT_FDCWD, "/usr/local/share/applications/mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_ALL,
0x7ffccea14370) = -1 EACCES (Permission denied)
6954  statx(AT_FDCWD, "/usr/local/share/applications/kde-mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_ALL,
0x7ffccea14370) = -1 EACCES (Permission denied)
35083 statx(AT_FDCWD, "/usr/local/share/applications/kde-mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffe9f0ced30) = -1 EACCES
(Permission denied)
35083 statx(AT_FDCWD, "/usr/local/share/applications/mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffe9f0ced30) = -1 EACCES
(Permission denied)
35083 statx(AT_FDCWD, "/usr/local/share/applications/mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_ALL,
0x7ffe9f0ceaa0) = -1 EACCES (Permission denied)
35083 statx(AT_FDCWD, "/usr/local/share/applications/kde-mimeapps.list",
AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_ALL,
0x7ffe9f0ceaa0) = -1 EACCES (Permission denied)

**Both kwin_wayland and plasmashell are getting `EACCES`, not `ENOENT`**

```bash
namei -l /usr/local/share/applications/mimeapps.list
/usr/local/share/applications/kde-mimeapps.list
```

## This might explain it: 
>`drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root local
drwxr-xr-x root root share
drwxr-x--- root root applications`
>    `mimeapps.list - No such file or directory`
>`f: /usr/local/share/applications/kde-mimeapps.list
drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root local
drwxr-xr-x root root share
drwxr-x--- root root applications`
>       `kde-mimeapps.list - No such file or directory`

### Note
`/usr/local/share/applications
drwxr-x--- root root`

A user cannot traverse the directory, so the lookup returns `EACCES` rather
than ordinary `ENOENT`.

```
$  for f in \
>   "$HOME/.config/mimeapps.list" \
>   /usr/local/share/applications/kde-mimeapps.list \
>   /usr/local/share/applications/mimeapps.list \
>   /usr/share/applications/kde-mimeapps.list
> do
>     printf '\n=== %s ===\n' "$f"
>     stat "$f"
> done

=== /home/me/.config/mimeapps.list ===
  File: /home/me/.config/mimeapps.list
  Size: 402             Blocks: 8          IO Block: 4096   regular file
Device: 259,7   Inode: 4064593     Links: 1
Access: (0640/-rw-r-----)  Uid: ( 1001/      me)   Gid: ( 2001/   users)
Context: unconfined_u:object_r:config_home_t:s0
Access: 2026-09-02 16:42:54.100618747 -0500
Modify: 2026-09-01 15:45:50.430867671 -0500
Change: 2026-09-01 15:45:50.434867683 -0500
 Birth: 2026-09-01 15:45:50.430867671 -0500

=== /usr/local/share/applications/kde-mimeapps.list ===
stat: cannot statx '/usr/local/share/applications/kde-mimeapps.list':
Permission denied

=== /usr/local/share/applications/mimeapps.list ===
stat: cannot statx '/usr/local/share/applications/mimeapps.list': Permission
denied

=== /usr/share/applications/kde-mimeapps.list ===
  File: /usr/share/applications/kde-mimeapps.list
  Size: 5413            Blocks: 16         IO Block: 4096   regular file
Device: 0,40    Inode: 14589635    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:usr_t:s0
Access: 2026-08-04 04:23:56.000000000 -0500
Modify: 2026-08-04 04:23:56.000000000 -0500
Change: 2026-08-30 19:55:58.065495561 -0500
 Birth: 2026-07-06 08:48:41.152859678 -0500

```
# 50+ hours of work and this is the fix???!?!!!

**Note the time:**
```bash
⚠ 15:18 /home/me # chmod 0755 /usr/local/share/applications
```
CPU use drops to 1% or less.

## Don't believe me?  Proof:
**Note the timestamp:**
```bash
15:27 ~ $  for i in {1..20}; do
>     stat -c 'inode=%i size=%s mtime=%y' "$CACHE"
>     sleep .5
> done
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
inode=4066069 size=2519874 mtime=2026-09-03 15:18:37.731177694 -0500
```

# break-down of the break-down:


>inaccessible `/usr/local/share/applications`
>`/usr/local/share/applications = 0750 root:root`                   ↰
>                             ↓                                     ↑
>I cannot traverse it
>                             ↓                                     ↑
>`statx(.../mimeapps.list) = EACCES`
>                             ↓                                     ↑
>`QFileInfo::exists() → false`
>                             ↓                                     ↑
>`TimestampChecker::checkFilesTimestamps() → false`
>                             ↓                                     ↑
>`KSycocaPrivate::needsRebuild() → true`
>                             ↓                                     ↑
>Plasma rebuilds Sycoca 
>                             ↓                                     ↑
>`clamd` on-access notes "better check that file!"
>Plasma rebuilds Sycoca 
>                             ↓                                     ↑
>KWin sees/rechecks it and rebuilds(do'h!)
>                             ↓                                     ↑
>alternating ~0.75 s cache replacement + CPU battle
>                             ⤷                                     ⤴
`

# Recommendation
1.  Cross post to openSUSE and other packagers!  (tell them to fix the
permission on `plocate`'s database while they are at it)
2.  Test for `EACCES` rather than ordinary `ENOENT` in both kwin and
plasmashell.  
        ‼  Don't keep at it if no permission, tell someone!
3.  Monitor rebuilding of the database; abort and report ping-pong matches
4.  If `kwin_akonadi` and `plasmashell` both do the same thing, they need to
make sure this sort of feedback loop is avoided.
5.  Need some smarter logic at the system monitoring level as this was not at
all obvious when I first looked in logs.  
6.  Consider lightweight KDE-wide resource monitor that can add the Qt
debugging variables and generate an alert
7.  Smarter debugging tools with use of either Ollama, or online LLMs, probably
with a rules-based expert system that first "rounds up the usual suspects". 
Much of Linux troubleshooting is a set of known rules (but not by me!) that
allow for a deterministic approach, which is going to have to lookup and see
what sort of tools the user has, consider prompting them to download
non-standard tools even if they are used used by an expert system.
8.  `clamonacc` needs to keep track of when it is being triggered repeatedly
for the same file and at least log it.  Not the first time it has been caught
in the middle, and it should recognize when its being hammered like this.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to