Bound watcher IPC backlog with targeted subscription recovery - #3582
Open
salemsayed wants to merge 1 commit into
Open
salemsayed wants to merge 1 commit into
salemsayed wants to merge 1 commit into
Conversation
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.
Human comments
What was wrong
The watcher child sends every event batch without tracking outstanding IPC writes. When the daemon stops reading, serialized messages accumulate without a bound. A real forked-process reproduction on latest upstream
c3067feabshows median child RSS growth of 196.79 MiB for 500,000 updates on Node 22. This confirms an outgoing-IPC defect, but does not establish it as the sole cause of the original reported watcher OOM. The earlier root-scope fixes in #2336 address a different allocation source. Investigation, reproducible commands, raw measurements, and browser proof.What changed
No server/daemon wire, public SDK, or CLI contract changes; no
HOST_DAEMON_PROTOCOL_VERSIONbump is needed. This bounds outgoing event retention, not native watcher memory or total RSS. Under overload, detailed events are replaced by conservative refreshes.How you verified
pnpm start:worktree --dryrun: 45 tasks passed, repeated successfully with 44 cache hits. Built source server/daemon health and real Chromium Diff-panel updates passed for create, edit, rename, delete, and reload in a fresh disposable instance. Screenshots are included.git diff --check. Production services were untouched. macOS/Windows native watchers and long-duration production workloads were not tested.Upstream CI also passed on this PR: all six test shards, build/typecheck/lint, Linux and macOS package smoke checks, contributor approval, and version gates. CI run. The workflow skipped iOS flows and its separate Node-compatibility matrix.
Main commands: