[BUG] IconResolver rebuilds full icon theme index every 60 s even when nothing changed
Submission checklist
- [x] I have searched existing issues and confirmed this is not a duplicate.
- [x] I am using the latest available version of Noctalia.
Bug description
Every 60 seconds the main thread spikes to ~75–100% of one core for ~1 s.
Findings:
- pidstat: spike exactly every 60 s, main thread only
- strace: right before the spike, noctalia reads ~/.config/gtk-3.0/settings.ini and ~/.config/gtk-4.0/settings.ini, then loads Papirus-Dark/index.theme and walks the whole theme tree (~2566 ENOENT on non-existent theme subdirectories per cycle)
- perf: time spent in std::filesystem::path / std::string ops + filldir64
- inotifywait: settings.ini and icon dirs are only read (CLOSE_NOWRITE), never modified – so the rebuild happens without any change
Expected: only rebuild when settings.ini or icon theme dirs actually change (mtime check or inotify).
Steps to reproduce
sudo strace -tt -p NOCTALIAPID -e trace=openat,getdents64,clone,clone3,execve -o /tmp/noctalia.trace grep -E ':5[67].' /tmp/noctalia.trace | grep -E 'openat|execve|clone' | awk '{print $2, $3}' | sort | uniq -c | sort -rn | head -40 grep -E ':5[67].' /tmp/noctalia.trace | grep ENOENT | grep -vE 'brightness' | awk '{print $3}' | sed 's|.*/||' | sort | uniq -c | sort -rn | head -20 N=$(grep -n -m1 'share/icons' /tmp/noctalia.trace | cut -d: -f1) sed -n "$((N-40)),$((N))p" /tmp/noctalia.trace inotifywait -m ~/.config/gtk-3.0 ~/.config/gtk-4.0 ~/.local/share/icons
Expected behavior
Do not read for no reason.. :D
Actual behavior
IconResolver rebuilds full icon theme index every 60 s even when nothing changed
Logs / error output
Noctalia version
5.2.1
Compositor
Niri
Distribution
Debian-based
Environment information
OS: PikaOS 4
Kernel: 7.2.6-pikaos
Additional context
No response
Same here. Some extra details from my side.
Setup: noctalia 5.2.1-101pika1 (the PikaOS 4 package) on Hyprland, so it is not specific to Niri.
The log names the source. Once a minute, ~/.cache/noctalia/noctalia.log gets a line like this:
2026-10-15 02:08:00.224 [DBG] [main] poll source 19IconThemePollSource dispatch took 852.7ms 2026-10-15 02:09:00.229 [DBG] [main] poll source 19IconThemePollSource dispatch took 856.9ms 2026-10-15 02:10:00.194 [DBG] [main] poll source 19IconThemePollSource dispatch took 820.7ms
It takes 820 to 950 ms every time. My log has 1319 of these lines. The other slow poll sources are rare (HttpClientPollSource 5, TimerPollSource 3, SystemBusPollSource 1). CPU time per thread between :58.5 and :00.7 of the minute is 850 to 860 ms on the main thread and 10 ms or less on every other thread.
I see the same thing you describe: nothing on disk changes. gtk settings.ini was last modified about three weeks ago, and nothing under the icon and pixmaps dirs changed in the 30 minutes before I checked. In my strace the poll() right before the scan returns 0 (Timeout) and the scan starts immediately, so it looks timer driven, not triggered by an inotify or Wayland event.
I also created the search dirs that don't exist on my system (~/.local/share/pixmaps, /usr/local/share/icons, /usr/local/share/pixmaps). The rescan still ran every minute at about 820 to 850 ms, so the missing base directories are not the cause. Most of the path accesses (openat + newfstatat) are under the two flatpak export dirs and /usr/share/icons/hicolor (about 1300 each), then Papirus and Papirus-Dark (about 224 each).
Skipping the rescan when settings.ini and the icon dirs have the same mtime, or using a much longer interval, would fix it for me.
Attached: an excerpt of the strace of the main thread around one scan, plus the matching log lines. My username is replaced by USER.
This looks fixed in v5.3.0 by 8c04d5b72 ("fix(icons): avoid blocking icon theme scans"). In 5.2.1 the 60 s check read every file in every icon directory, which matches the ~850 ms you both measured. Since 5.3.0, inotify watches pick up changes and the 60 s fallback only checks directory modification times. On current main, that check takes about 30 ms for ~2,000 icon dirs on my machine (Fedora 44, debug build). Could you confirm on 5.3.0 or later, and close if it's gone?
Confirmed fixed on my side with v5.4.1 (c530c35, NixOS, Umbriel).
- Log: no
IconThemePollSource dispatch tooklines in ~2 h of uptime (~119 checks), with debug logging on. That line is written from 50 ms, so every check stayed below that. On 5.2.1 the reported values were 820–950 ms per check. - Main thread CPU: 0.8% average over 185 s, sampled every 100 ms from
/proc. The highest 100 ms window was 40%, and there is no 60 s pattern anymore. - inotify: active, with 925 watches on one handle.
I did not re-run the strace from my original report, so I have no new ENOENT count. Read syscalls don't show a per-minute pattern either.
Thanks for the fix!