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
Home holds 66 to 130 MiB per stalled link reader: upstream read-ahead and request copies #8601
When a Child's reader stalls on a streamed response relayed by the Home, the Home process keeps growing well past the bytes in flight. This affects the HTTP link relay today, and it will also affect the link WebSocket once it exists. Measured on a 4-core Linux VM with four stalled sockets: peak RSS over idle per socket, kernel VmHWM reset at idle, fake upstream sending near-4 MiB events.
Run
Request
Upstream
Transport
Per socket
R1
1 KiB
free-running, chunks up to 256 KiB
WebSocket
100.6 MiB
R2
1 KiB
held after 16 MiB per stream, chunks up to 256 KiB
WebSocket
76.0 MiB
R3
1 KiB
held after 16 MiB, chunks up to 256 KiB
HTTP relay
66.3 MiB
R4
near-8 MiB
held after 16 MiB, chunks up to 16 MiB
WebSocket
134.9 MiB
R5
near-8 MiB
held after 16 MiB, chunks up to 16 MiB
HTTP relay
129.7 MiB
The trigger is a stalled reader. Two mechanisms show:
Read-ahead amplification. Bun's fetch keeps reading the upstream body ahead of a reader that does not consume it. R1 against R2: about 25 MiB per socket more when the upstream is not held. The upstream enqueued 14 to 39 MiB per stream by the stall when free-running.
Request copies. A near-8 MiB request costs about 60 MiB per socket more than a 1 KiB one on the HTTP relay (R5 against R3), so the request body is copied several times on its way upstream.
The Home has no process-wide bound on either, and an HTTP request holds this for as long as its reader stalls. Link WebSocket sockets live longer than HTTP requests, so 24 stalled sockets would hold about 3 GB on the Home. That is why this matters before enabling the link WebSocket. Possible directions: bound read-ahead by pulling the upstream body only as the reader drains; drop request-body copies once the upstream request is built. Not fixed in the link WebSocket PR.
Owner decision (lidge-jun, 2026-11-16): apply paced upstream reads to every relayed Remote Link turn, not only while the link WebSocket feature is on; keep the WebSocket-only log fields behind that switch.
Activity
fix(responses): while the link WebSocket feature is on, a stalled Rem…
fix(link): the link WebSocket's memory acceptance passes: a link sock…
lidge-jun commentedon Nov 16, 2026
Owner decision (lidge-jun, 2026-11-16): apply paced upstream reads to every relayed Remote Link turn, not only while the link WebSocket feature is on; keep the WebSocket-only log fields behind that switch.
fix(link): every relayed Remote Link turn reads its upstream only as …