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

            Bug ID: 525030
           Summary: plasmashell continuously rebuilds ksycoca6 cache in a
                    self-triggered inotify loop (no external trigger)
    Classification: Plasma
           Product: plasmashell
      Version First 6.6.6
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: 1.0

Created attachment 195627
  --> https://bugs.kde.org/attachment.cgi?id=195627&action=edit
strace of plasmashell during active ksycoca rebuild loop, filtered to
sycoca/.lock related syscalls

DESCRIPTION
plasmashell enters a continuous ksycoca6 cache rebuild loop (roughly
once per second), causing sustained disk writes (5-30MB/s) and high
CPU usage on plasmashell/kwin_wayland. Confirmed via strace that
plasmashell itself is the sole actor causing the rebuild — no
external trigger (dbus signal, mime database change, .desktop file
change, or third-party process) was found after extensive
eliminatiom

STEPS TO REPRODUCE
Not yet reliably reproducible from a clean state; occurs
intermittently on this system after a Wayland session has been
running for a while. Once triggered, the loop is continuous and
does not stop on its own until plasmashell is restarted (and often
resumes again later).

OBSERVED RESULT
strace -f -e trace=%file -p <plasmashell_pid> shows this exact
sequence repeating roughly once per second:

  openat(AT_FDCWD, ".../ksycoca6_es-CR_...=", O_RDONLY|O_CLOEXEC) = 47
  inotify_add_watch(13, ".../ksycoca6_es-CR_...=",
    IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|
    IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_DONT_FOLLOW) = <fd>
  openat(AT_FDCWD, ".../ksycoca6_es-CR_...=.lock",
    O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 60
  linkat(AT_FDCWD, "/proc/self/fd/61", AT_FDCWD,
    ".../ksycoca6_es-CR_...=.<random6>", AT_SYMLINK_FOLLOW) = 0
  rename(".../ksycoca6_es-CR_...=.<random6>",
    ".../ksycoca6_es-CR_...=") = 0
  unlink(".../ksycoca6_es-CR_...=.lock") = 0

immediately followed by the same openat + inotify_add_watch +
rebuild sequence again.

The rename() call above produces IN_MOVED_TO/IN_CREATE events on
the exact path plasmashell just registered its own inotify watch
on (see the flags above). This looks like plasmashell's own
database-change handling does not distinguish "I just wrote this
file myself" from "an external process changed it," so its own
rename() re-triggers the same rebuild path — a self-sustaining
loop with no external cause.

Investigation performed to rule out external triggers:
- dbus-monitor on the session bus during an active loop episode:
  no traffic mentioning sycoca/KSycoca at all.
- inotifywait -r on ~/.local/share/{applications,mime,kservices6}
  and /usr/share/{applications,mime}: no file changes during an
  active loop episode.
- kglobalacceld is not running on this system at all (confirmed via
  pgrep), ruling out the known GlobalShortcutsRegistry::
  refreshServices() recursion path (bug 429593 / fixed for
  kglobalacceld in commit b84d217f, "Postpone processing KSycoca to
  the next event loop cycle", Plasma 6.1.0).
- strace -f -e trace=%file on kded6 during an active loop episode:
  no sycoca/.cache-related syscalls at all; kded6 only performs
  routine Solid statfs() calls. kded6 does end up with a stale file
  descriptor pointing to a deleted version of the cache (confirmed
  via /proc/<kded6_pid>/fd), but this is a side effect of the
  rename, not a cause.
- strace -f -e trace=%file directly on plasmashell during an
  active loop confirms plasmashell is the sole process performing
  the openat/.lock/linkat/rename/unlink sequence shown above.
- Confirmed to still occur after upgrading from Plasma 6.6.6 to
  6.7.4 (full system reboot performed after upgrade, not just a
  plasmashell restart).

EXPECTED RESULT
plasmashell's KSycoca file-change handling should not re-trigger a
rebuild in response to its own write of the cache file.

SOFTWARE/OS VERSIONS
Plasma 6.6.6 and 6.7.4 (both affected), Gentoo (OpenRC init, not
systemd), Wayland session, kwin_wayland.

ADDITIONAL INFORMATION
Full strace log of an active loop episode (both plasmashell and
kded6, ~15 second capture) available on request / attached.

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

Reply via email to