Files
hapi/hub/src/web
eb84dfa0d9 fix(hub): don't crash when an SSE client disconnects while gzip output is buffered (#2314)
compressSseResponse pauses zlib when the client falls behind, so a large
event can leave compressed output parked in zlib's readable buffer. pull()
calls gzip.resume(), which flows that buffer on a later tick. If the client
disconnects in between, cancel() closes the stream and destroys zlib, but
the pending flow still emits 'data' and controller.enqueue() throws
"Invalid state: Controller is already closed". The throw happens inside a
zlib event handler, so nothing catches it and the hub process exits.

Track when the stream has finished (closed, errored or cancelled) and stop
touching the controller after that.

via [HAPI](https://hapi.run)

Co-authored-by: HAPI <noreply@hapi.run>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-09 12:05:40 +08:00
..