Skip to content

fix(download): release the backend read when the client leaves before storage answers - #18

Open
chenrui333 wants to merge 1 commit into
review-base/upstream-devfrom
fix/download-client-gone
Open

chenrui333 wants to merge 1 commit into
review-base/upstream-devfrom
fix/download-client-gone

Conversation

@chenrui333

Copy link
Copy Markdown
Owner

Review copy of a proposed upstream change, based on falcondev-oss/github-actions-cache-server@dev (6ae06c2). Upstream accepts pull requests from collaborators only, so this branch is offered through an upstream issue.

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. pipeline rejects with ERR_STREAM_UNABLE_TO_PIPE without 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). Checks res.destroyed || res.closed before piping and destroys the body on every error exit.

… 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>
@chenrui333

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T21:04:22.366112Z 29b4411 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 29b44119d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant