Repository navigation
fix: poll directories the system has no watcher left for, instead of reporting their files as removed - #359
Conversation
…reporting their files as removed
🦋 Changeset detectedLatest commit: e3cb35e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will not alter performance
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughWhen a directory watcher reports Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
638a6e40-2343-45c3-8fe6-9bbeee653e5f
📒 Files selected for processing: 4
.changeset/watcher-limit-polling.mdlib/DirectoryWatcher.jstest/WatcherLimit.test.jstypes/DirectoryWatcher.d.ts
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #359 +/- ##
==========================================
+ Coverage 92.65% 92.72% +0.07%
==========================================
Files 8 8
Lines 1389 1403 +14
Branches 416 420 +4
==========================================
+ Hits 1287 1301 +14
Misses 96 96
Partials 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #46.
The issue's title is outdated, because the error is logged now. The bug behind it is still real. When
fs.watchfails withENOSPC(fs.inotify.max_user_watcheson Linux) orEMFILE,onWatcherErrortreats the directory as removed:Fix: for
ENOSPC/EMFILEthe directory still exists, so it is not reported as removed. It is polled instead, at the interval ofpoll: true(5007 ms). The error is logged once per process, with a hint to raise the system limit or setWATCHPACK_POLLING. Directories that did get a watcher keep reacting at once. Other watcher errors are unchanged.Real limit on Linux (
max_user_watches= 50, 100 watched directories, every file then edited):mainremoveeventsTests
test/WatcherLimit.test.jsmakesfs.watchthrowENOSPCfor one directory. It expects no removal, a single watch attempt and log line, and the edit to be reported. It fails onmainand passes here, also withWATCHPACK_POLLING=200.WATCHPACK_POLLING=200.npm run lintis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
Generated by Claude Code
Summary by CodeRabbit