From 94f47b577dedc89d36cf2993ec21759d3e08a020 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 1 Nov 2025 23:09:16 -0700 Subject: [PATCH] Update weed/server/filer_server_handlers_read.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- weed/server/filer_server_handlers_read.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index 2bf01b824..5f886afa9 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -288,9 +288,10 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) } } - // Use background context for streaming so client disconnects/cancellations don't abort volume server operations. + // Use a detached context for streaming so client disconnects/cancellations don't abort volume server operations, + // while preserving request-scoped values like tracing IDs. // Matches S3 API behavior. Request context (ctx) is used for metadata operations above. - streamCtx, streamCancel := context.WithCancel(context.Background()) + streamCtx, streamCancel := context.WithCancel(context.WithoutCancel(ctx)) streamFn, err := filer.PrepareStreamContentWithThrottler(streamCtx, fs.filer.MasterClient, fs.maybeGetVolumeReadJwtAuthorizationToken, chunks, offset, size, fs.option.DownloadMaxBytesPs) if err != nil {