Repository navigation
feat: end a stream that goes silent instead of waiting out the request - #133
Open
TiaraBasori wants to merge 1 commit into
Open
TiaraBasori wants to merge 1 commit into
TiaraBasori wants to merge 1 commit into
Conversation
… request An upstream that accepts a request and then stops sending holds the forward loop on a parked read. Nothing downstream notices: the response headers are already sent, the first-event wait is long over, and the only remaining bound was the request-level timeout (retry.timeout_seconds, 300s by default). A client therefore waited minutes for a stream that had already stalled. performance.stream_idle_timeout_seconds bounds silence inside an established stream. The watchdog is armed per read and re-armed on every completed read, so a slow but active generation is never cut; when it fires it closes the upstream body, which is what actually unblocks a read parked on a silent socket, and the reader reports the stall as an upstream error. The stall is classified before the client-cancel check in all three stream paths: the watchdog does not touch the client, so the client is owed an in-band error event explaining why the stream stopped. ForwardStream, TranscodeStream and the rotation stream all emit one; the request is logged as stream_error. Default 0 keeps the previous behavior.
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.
An upstream that accepts a request and then stops sending leaves the forward loop parked on a read. Nothing downstream notices: the response headers are already sent, the first-event wait is long over, and the only remaining bound was (300s by default), so the client waited minutes for a stream that had already stalled.\n\n bounds silence inside an established stream.\n\n- The watchdog is armed per read and re-armed on every completed read, so a slow but active generation is never cut.\n- When it fires it closes the upstream body, which is what actually unblocks a read parked on a silent socket; canceling a context alone does not, because the body was opened under the request context.\n- The stall is classified before the client-cancel check on all three stream paths (ForwardStream, TranscodeStream, rotation), so the client gets an in-band error event explaining why the stream stopped, and the request is logged as instead of .\n- Default keeps the previous behavior; the docs note it should sit below .\n\nVerified against a real gateway binary and an upstream that sends one event and then holds the connection open: with and an idle timeout of 2s, the client received the first event, the error event and at 2046ms. A 400ms gap with a 300ms watchdog is cut; a 100ms gap is not; an actively ticking stream runs to completion untouched.