You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSE event subscriptions buffer without bound when the consumer stops draining #31923
A client that opens /event or /global/event and stops draining leaks server memory. Each subscription buffers events in an unbounded queue, and the only cleanup is the response fiber ending, which requires a disconnect signal. A TCP connection stuck in CLOSE_WAIT never sends one, so the listener stays registered and the queue grows with every event the server emits.
The megathread has field measurements of this pattern: 24.5GB RSS with zombie CLOSE_WAIT connections, +434MB/30s growth at a stable zombie count (#20695 (comment)).
Two aggravators in current dev:
the instance endpoint filters by directory after buffering, so a stalled subscriber accumulates all instances' events
the global endpoint buffers through Stream.callback with the same exposure
Reproduction
Open an event endpoint, never read the body, publish events past any reasonable backlog size. The per-connection queue grows monotonically and the response stream never terminates. A deterministic regression test is included in the linked PR.
Version
Current dev. Matches the v1.4.3 behavior reported in the megathread; the Effect migration preserved the pattern (Queue.unbounded per connection in handlers/event.ts).
Duplicate of #22198 — the duplicate-detection bot is right, that report covers the same root cause with field measurements. Closing this one; the fix PR #31922 now links #22198 directly.
Activity
github-actions commentedon Jun 11, 2026
This issue might be a duplicate of existing issues. Please check:
AsyncQueuegrowth, includes field measurements of 24.5GB RSS and +434MB/30s growth (the same figures cited here)Queue.unboundedper SSE connection issue inhandlers/event.tsandhandlers/global.tsondev, same expected fix of bounding the queue under backpressureBoth issues describe the identical code pattern and memory growth behavior. You may want to reference or close in favor of one of those.
MartinCajiao commentedon Jun 11, 2026
Duplicate of #22198 — the duplicate-detection bot is right, that report covers the same root cause with field measurements. Closing this one; the fix PR #31922 now links #22198 directly.