Repository navigation
fix(download): release the backend read when the client leaves before storage answers - #18
Open
chenrui333 wants to merge 1 commit into
Open
chenrui333 wants to merge 1 commit into
chenrui333 wants to merge 1 commit into
Conversation
… storage answers A client can give up on /download while its storage read is still waiting, for example a GetObject queued behind a saturated socket pool. The body then arrives for a response that is already closed. `pipeline` rejects a closed destination with ERR_STREAM_UNABLE_TO_PIPE before it takes ownership of the source, and the route rethrew without destroying it, so the body pinned its backend socket and the Storage Reader Lease for the life of the process. Enough of them fill the pool and every storage call queues. Check the response before piping and destroy the body if the client is gone, and destroy it on every error exit of the pipe as well. falcondev-oss#282 and falcondev-oss#291 already cover a client leaving mid-body. tests/download-client-gone.test.ts holds the storage read until the client has hung up, then checks that the backend socket and the reader lease are released; on Node 26.12.1 the socket stayed held before this change. Signed-off-by: Rui Chen <rui@chenrui.dev>
Owner
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This was referenced Oct 24, 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 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.
If a client disconnects while
storage.download()is still waiting (for example a GetObject queued for a socket), the body arrives for an already-closed response.pipelinerejects withERR_STREAM_UNABLE_TO_PIPEwithout taking ownership of the source, and the route rethrows without destroying it, so the backend socket and reader lease stay pinned (reproduced on Node 26.12.1 with falcondev-oss#282/falcondev-oss#291). Checksres.destroyed || res.closedbefore piping and destroys the body on every error exit.