Diagnostic step 1
Refactor: use a single watcher (or a small pool) in the parent thread that broadcasts events to workers, avoiding per-worker watchers.
Generated Oct 27, 2026, 9:31:39 AM
Refactor: use a single watcher (or a small pool) in the parent thread that broadcasts events to workers, avoiding per-worker watchers.
Use a battle-tested library such as chokidar with polling when watching very large trees or on non-local filesystems; configure usePolling and interval.
Ensure every fs.FSWatcher.close() is called synchronously before terminating a worker; add explicit handshake to confirm close completion.
Monitor /proc/<pid>/fd and inotify counts; keep fs.inotify.max_user_watches only as a mitigation, not a fix.
If suspecting a Node bug, reproduce on a minimal test and open an issue with a repro; run on a newer Node LTS if possible.