Repository navigation
Detect stalled and Hono-swallowed SSE writes (CL-7246) - #617
Merged
Merged
Conversation
Hono StreamingApi.write never rejects, so a write that looks successful can still have failed or hung. Pin both failure paths before the detection lands.
After every writeSSE, treat an errored writer, aborted or closed stream, or a write that never settles as a failed delivery: report, tear down, and close so a dead client cannot stay subscribed.
Hono close() queues behind an in-flight writer.write, so a stalled sink never drops the socket. Abort the writer instead, skip reportError when onAbort already tore down, and apply the same timeout/teardown path to the presence SSE stream.
Client abort mid-write must not reportError and must still abort the writer.
Skip-report on client abort also skipped dropStream, so Hono close() waited on the still-in-flight write. Still skip reportError; still abort the writer on chat and presence streams.
Contributor
Author
|
Fixes CL-7246 |
Aborting a healthy Hono stream errors the body with undefined, which failed the live share-revocation test on Linux CI. Hung writes still abort the writer so close() cannot stall behind them.
Contributor
Author
Self-reviewVerdict: the stall/swallowed-write detection and teardown logic are correct and well-tested against Hono's real
Tests run (from
|
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.
Summary
Hono's
StreamingApi.writeswallows writer errors inside a barecatch {}, sowriteSSEcan resolve after a failed write or hang forever on a stalled sink. The workbench SSE bridge treated that as a successful delivery and kept the subscriber alive.Changes
writeSSE, treat an errored underlying writer (desiredSize === null), an aborted or closed stream, or a write that never settles within 10s as a failed delivery.reportError, tear down both subscriptions, and close the stream so the client reconnects instead of sitting on a zombie connection.https://linear.app/abklabs/issue/CL-7246
Fixes CL-7246