hardening(proxy): bound the remaining unbounded worker collections - #414
Merged
Conversation
Closes the post-#395 retention audit umbrella (issue #405): - DapProxyWorker.preConnectQueue and commandQueue capped at MAX_QUEUED_COMMANDS (256); overflow answers the live requestId with an error response instead of queueing forever (silent eviction would hang the client) - ChildSessionManager.storedBreakpoints cleared in shutdown() and a file clearing to zero breakpoints deletes its key (replaying [] to a fresh child was a no-op) - CdpFunctionBreakpointBridge.scriptUrls FIFO-capped at MAX_SCRIPT_URLS (10k) for long-lived JS debuggees with module churn Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 #405
Closes the umbrella from the post-#395 retention audit: the remaining unbounded in-memory collections where a misbehaving adapter or debuggee turns into unbounded worker memory. Each is bounded per its semantic, with an overflow test per site (precedent:
OUTPUT_BUFFER_CAP's cap + accounting).Bounds
DapProxyWorker.preConnectQueueMAX_QUEUED_COMMANDS(256)DapProxyWorker.commandQueueMAX_QUEUED_COMMANDS(256)ChildSessionManager.storedBreakpointsshutdown()(was the one map that outlived it); a file clearing to zero breakpoints deletes its key instead of storing an empty array — a fresh child never saw them, so replaying[]was a no-opCdpFunctionBreakpointBridge.scriptUrlsMAX_SCRIPT_URLS(10,000), FIFOscriptParsedentry evicted; a stale entry only costs a fallback url lookup. Growth vector: long-lived JS debuggees with module churn (dev servers, jest watch).detach()already reaches the existing clearSilent eviction was ruled out for the queues deliberately: every queued command holds a live requestId, so dropping one would hang the client forever — overflow must answer.
Tests (TDD, watched fail first)
shutdown()clears stored breakpoints; empty-set store deletes the key.scriptParsedevents → map holds exactly the cap, oldest evicted, newest intact.npm testgreen,npm run lintclean.This closes out the memory-footprint audit follow-ups (#399–#405).
🤖 Generated with Claude Code