Skip to content

hardening(proxy): bound the remaining unbounded worker collections (queues, storedBreakpoints, scriptUrls) #405

Description

@debugmcpdev

Problem

Umbrella for the remaining unbounded in-memory collections found during the post-#395 retention audit. None is known to bite in practice — each is bounded indirectly by protocol behavior — but they're the spots where a misbehaving adapter/debuggee turns into unbounded server memory, and each is a small, testable fix.

Site Growth vector Notes
DapProxyWorker.commandQueue (src/proxy/dap-proxy-worker.ts:106, pushes :978/:982) Commands queued while the adapter isn't ready; drained only by drainCommandQueue() (:1069-1081) If the drain never fires (adapter wedged pre-init), queue grows with every client command until session timeout
DapProxyWorker.preConnectQueue (:107, push :925, drain :1161-1165) Same shape, pre-connect window Same caveat
ChildSessionManager.storedBreakpoints (src/proxy/child-session-manager.ts:132, set :271) Keyed by absolute source path; no explicit clear found Replayed to new children (:482, :595); worker-lifetime retention of every file that ever had a breakpoint
CdpFunctionBreakpointBridge.scriptUrls (src/proxy/cdp-function-breakpoint-bridge.ts:118) One entry per script the debuggee ever parses Long-lived JS processes with dynamic module churn (dev servers, jest watch) grow this indefinitely

Proposal

Per site: pick a bound that matches the semantic (cap + reject-with-error for the queues, e.g. a few hundred entries; LRU or size cap for scriptUrls; explicit lifecycle clear for storedBreakpoints on session teardown) and add a unit test that overflows it. The output buffer (OUTPUT_BUFFER_CAP, src/session/output-buffer.ts:11-13) is the in-repo precedent for cap + dropped-count accounting.

Low priority — file-and-batch material for a hardening sprint, not urgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions