You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ignore.Matcher goroutine leaks on every folder restart/removal when CacheIgnoredFiles is enabled #10812
ignore.New(fs, ignore.WithCache(true)) starts a background goroutine
(go m.clean(2*time.Hour)) to periodically clean the match cache. The Matcher also exposes a Stop() method meant to shut that goroutine down.
However, Stop() is never called anywhere in the codebase. Every time a
folder is restarted (e.g. via a config change) or removed, lib/model
builds a brand new ignore.Matcher and drops the reference to the old one
in cleanupFolderLocked — without stopping it first.
What did you expect to happen
The old matcher's background goroutine and its cache should be cleaned up
when the folder is restarted or removed.
Reproduction / evidence
With CacheIgnoredFiles: true, instrumented a test that restarts a folder
50 times and counts goroutines before/after:
Before fix: goroutines increase by exactly 50 (one leaked per restart)
After fix (calling ignores.Stop() in cleanupFolderLocked before
dropping the reference): delta is 0
On a long-running instance with frequent config edits or folder restarts,
this leaks a goroutine (and its cache map) per restart indefinitely.
Activity
chore: remove ignore file caching entirely (syncthing#10813)