fix(server): stop Linux watcher event storms on busy working trees#794
Merged
boudra merged 1 commit intogetpaseo:mainfrom May 7, 2026
Merged
fix(server): stop Linux watcher event storms on busy working trees#794boudra merged 1 commit intogetpaseo:mainfrom
boudra merged 1 commit intogetpaseo:mainfrom
Conversation
On Linux fs.watch isn't recursive, so each working tree manually walks the entire subtree and registers a per-directory watcher. Every inotify event then re-scans the tree and rebuilds watchers. A working tree containing a directory that's continuously written (e.g. test-runtime data, build artefacts) drives the event loop to 100% CPU and the daemon stops responding on its websocket. Skip git-ignored directories when walking — load `git ls-files -o -i --directory --exclude-standard` once per root (5 min cache) and skip its entries. Cap the walked directory count at 5000 so a misconfigured repo can't blow past the inotify budget. Add a 2s cooldown between refresh passes so a flurry of events collapses into one re-scan instead of a tight loop.
40063a1 to
6b15351
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #795
Summary
fs.watchisn't recursive, so the working-tree watcher walks the whole subtree and registers a per-directory watcher; every inotify event then re-scans the tree and rebuilds watchers. A continuously-written subtree pegs the event loop at 100% CPU and stalls the websocket.git ls-files -o -i --directory --exclude-standardonce per root with a 5 min cache.do/whileloop.Test plan
npx vitest run src/server/workspace-git-service.test.ts --bail=1— 17/17npm run typecheck/npm run lint/npm run format(pre-commit hook)