mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-06-09 18:32:43 +00:00
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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user