Uh oh!
There was an error while loading. Please reload this page.
fix requests hanging forever when a streamed read stops delivering rows - #606
Merged
Conversation
A database error raised while rows are being streamed is not delivered by the underlying library, so the stream stalls instead of failing: nothing is logged, no response is sent, and the connections the sub-query holds stay held until the client gives up. A connection lost mid-stream — a failover in a replicated cluster, for instance — looks the same from here. The row source now ends in a timeout that turns such a stall into an error that does propagate, which also releases the connection budget deterministically instead of waiting for the client to disconnect. It is a per-element timeout, so a slow but progressing read is unaffected however long it runs in total; only a gap longer than the window ends the stream. The window is deliberately generous: this detects a stalled read, it is not a query budget, so it has to sit well above the slowest legitimate gap between two rows. A database-side statement_timeout is no substitute, because its error would be swallowed the same way.
Uh oh!
There was an error while loading. Please reload this page.
azahnen pushed a commit
that referenced
this pull request
Sep 1, 2026
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 freeto 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.
A database error raised while rows are being streamed is not delivered by the underlying library, so the stream stalls instead of failing: nothing is logged, no response is sent, and the connections the sub-query holds stay held until the client gives up. A connection lost mid-stream — a failover in a replicated cluster, for instance — looks the same from here.
The row source now ends in a timeout that turns such a stall into an error that does propagate, which also releases the connection budget deterministically instead of waiting for the client to disconnect. It is a per-element timeout, so a slow but progressing read is unaffected however long it runs in total; only a gap longer than the window ends the stream. The window is deliberately generous: this detects a stalled read, it is not a query budget, so it has to sit well above the slowest legitimate gap between two rows.
A database-side statement_timeout is no substitute, because its error would be swallowed the same way.