Repository navigation
fix: abort incomplete streamed responses - #245
Merged
Merged
Conversation
[Medium impact] The PR appears safe to merge with its explicitly accepted HTTP/1.0 limitation. SummaryTAG returns upstream body-copy errors and aborts responses after headers are sent, without appending S3 error XML.
Reviews (3) · Last reviewed commit: "fix(forward): drop the HTTP/1.0 reset pa..." · Reviewed by Greptile |
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
perfloop
Bot
force-pushed
the
perfloop-pr-open-jbd53f0x6f
branch
from
October 21, 2026 09:44
712e2b5 to
0a25dcb
Compare
When a streamed upstream body fails mid-copy after the status is committed, handleWithError aborts the response with panic(http.ErrAbortHandler). The previous version special-cased HTTP/1.0 requests: it hijacked the connection, unwrapped tls.Conn to the TCP socket, and SetLinger(0)'d it so the close went out as a TCP RST, on the theory that a 1.0 client (which reads an unknown-length body to EOF) could otherwise not distinguish truncation from completion. That path is removed. Hijack plus a forced RST is a fragile, transport- specific hack for a protocol no real client uses against TAG, and it bypassed the sanctioned Go abort. HTTP/1.0 now takes the same ErrAbortHandler path as HTTP/1.1 and HTTP/2: Go closes the connection without finishing the framing. A 1.0 client cannot tell that from a complete response, and that limitation is accepted and noted at the abort site. Tests: the HTTP/1.0 and HTTP/1.0+TLS truncation cases are replaced by a single HTTP/1.0 case that asserts only that the handler aborts (the connection closes, nothing beyond the upstream prefix and no error XML is delivered) without asserting the client can observe truncation. The HTTP/1.1 and HTTP/2 cases and the PUT/DELETE/tiered-marker gating tests are unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6 (cherry picked from commit d843d2fa43065a7cd2d1af83ba6440e012f101cf)
ovaistariq
approved these changes
Oct 21, 2026
|
🎉 This PR is included in version 1.22.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
TAG now returns upstream body-copy failures and aborts a committed downstream response instead of finishing framing around a received prefix. It never appends S3 error XML after headers are committed.
HTTP/1.0 normally uses connection close to end an unknown-length body, so this path resets the underlying TCP connection; TLS uses the underlying TCP socket as well. HTTP/1.1 and HTTP/2 use
http.ErrAbortHandler.Upstream status, rather than downstream delivery, owns write bookkeeping. Confirmed 2xx streamed PUT and DELETE operations still invalidate cache state, and tiered PUTs still publish their upstream marker when caching is enabled. The write-through tee holds its reservation until its asynchronous cache work completes. A rejected write does not trigger post-forward invalidation.
TestRoutedListBucketsTruncatedUpstreamResponseAbortssends authenticated signing-mode ListBuckets through the real router to an upstream that sends chunked HTTP 200 and closes before the terminal chunk. It requires a transport or body-read error for HTTP/1.1 (includingConnection: close), plain and TLS HTTP/1.0, and HTTP/2.TestRoutedListBucketsCompleteResponsesRemainCompletepasses on comparison revision19e1370439c826758a348bdf887d8ad0337ac2a6and final revision0a25dcb2711c48eae0deceb4d29fd2dabe9c810c; it covers known- and unknown-length responses.TestRoutedListBucketsAuthFailureBeforeCommitmentRemainsS3Erroralso passes on both revisions and preserves pre-header signature errors.TestExecuteAndStreamReturningMetaReturnsBodyReadErrorchecks that a copy error preserves status and ETag.TestHandlePutObject_ReinvalidatesAfterResponseCopyErrorandTestHandleDeleteObject_ReinvalidatesAfterResponseCopyErrorcover post-2xx invalidation;TestHandlePutObject_Non2xxResponseCopyErrorKeepsRacingRefillandTestHandleDeleteObject_Non2xxResponseCopyErrorKeepsRacingRefillpreserve rejected-write refills. The tiered testsTestTieredUpstreamPutCommitsMarkerAfterResponseCopyError,TestTieredRejectedUpstreamPutWithResponseCopyErrorKeepsLocalObject,TestTieredDeleteConvergesAfterResponseCopyError, andTestTieredRejectedDeleteWithResponseCopyErrorKeepsMarkerpreserve marker state for confirmed and rejected writes.TestHandlePutObject_WriteThroughTee_ResponseCopyErrorInvalidatesAndReleasesReservationchecks tee reservation lifetime.This condition holds with this change and does not hold at
19e1370439c826758a348bdf887d8ad0337ac2a6:For authenticated ListBuckets GETs through handlers.Server.Router in signing mode over HTTP/1.0 (plain or TLS), HTTP/1.1, and HTTP/2, a chunked upstream HTTP 200 closed before its terminal chunk must make the client observe a transport or body-read error rather than complete the truncated prefix as success..The six repository checks
make build,make test,make test-integration,make test-race,make test-coverage, andmake lint-cipassed. The shell adapter used to report the comparison is not included in this pull request; the native regression tests are. Production frequency and SDK-specific effects remain unmeasured. Response-capture operations use a separate path and are unchanged.Generated by Perfloop.
Note
Medium Risk
Changes core HTTP streaming and post-mutation cache invalidation when clients disconnect mid-response; behavior is well-tested but affects all proxied streaming traffic and write paths.
Overview
Streamed upstream responses now fail closed when body delivery breaks. The forwarder propagates
io.Copyerrors after status/headers are committed, andhandleWithErroraborts viahttp.ErrAbortHandlerinstead of logging and leaving a truncated success or appending S3 error XML.Cache and tiered bookkeeping follow upstream HTTP status, not client delivery success. Confirmed 2xx streamed PUT/DELETE still run post-forward re-invalidation (and tiered marker/delete convergence) when the response body fails to reach the client; non-2xx responses still skip that work so racing refills are preserved.
Docs describe this direct-streaming behavior. New router and proxy tests cover truncated ListBuckets across HTTP/1.0–HTTP/2, body-copy errors on forward, and invalidation/marker/tee-reservation paths after delivery failures.
Reviewed by Cursor Bugbot for commit 26f9003. Bugbot is set up for automated code reviews on this repo. Configure here.