Repository navigation
Conversation
…angs up Misses that are not coalesced (Range and conditional requests, and misses the spool cannot share) create the cache writer with the request context. Every cache backend checks that context when the write commits, and an S3 commit waits for the upload and metadata write. A client that has the whole body usually hangs up during that wait, so the entry is discarded and the fill is counted as canceled. The writer now uses a context that keeps the request's values and outlives its cancellation by up to 30 seconds. The origin request is still request-scoped, so a client that leaves mid-body still aborts the write. Signed-off-by: Ravi Agarwal <ravi@perplexity.ai> Co-authored-by: Perplexity <noreply@perplexity.ai>
Codex Review Summary: ✅ CompletedThis 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. |
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.
Coalesced misses already fill the cache from a detached context. Misses that aren't coalesced still create the cache writer with the request context: Range and conditional requests, and misses the spool can't share. Every cache backend checks that context when the write commits, and an S3 commit also waits for the upload and the metadata write. A client that has the whole body usually closes its connection during that wait, which cancels the request, so:
Failed to fetch and cachewithcontext canceled;cachew.cache.fillsrecords the fill ascanceled.Change
success.Testing
TestUncoalescedFillSurvivesClientHangupsends a conditional miss through a real HTTP server, with a cache whose commit is held until the server has seen the client hang up. When the client reads the full body, the entry is stored and the fill counts as a success. When it reads half while the origin is still sending, nothing is stored.TestDetachedFillContextGracechecks the 30-second bound.Created with Perplexity