s3: skip 503 when client disconnects during remote cache wait (#10071)

s3: don't write 503 to a disconnected client during remote cache wait

When the remote-only cache poll returns without chunks, re-check the
request context before emitting 503 + Retry-After. A client that
disconnected during the wait surfaces as context.Canceled, which the
caller already handles silently; writing to the closed connection only
produced broken-pipe log noise.
This commit is contained in:
Chris Lu
2026-06-23 15:31:08 -07:00
committed by GitHub
parent 0403e47ef6
commit 7abed4e517
+5
View File
@@ -1011,6 +1011,11 @@ func (s3a *S3ApiServer) streamFromVolumeServers(w http.ResponseWriter, r *http.R
}
return newStreamErrorWithResponse(cacheErr)
} else {
// Client disconnected during the cache wait: report cancellation, not 503,
// so we don't write to a closed connection.
if ctxErr := r.Context().Err(); ctxErr != nil {
return ctxErr
}
// Cache not ready yet; return 503 with Retry-After for client backoff
glog.V(1).Infof("streamFromVolumeServers: remote object %s/%s not cached yet, returning 503 for retry", bucket, object)
w.Header().Set("Retry-After", "2")