From a2863bf83be6590c3ca66584eae385d11dcbb07a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 28 Oct 2026 00:35:52 -0700 Subject: [PATCH] wdclient: count an elapsed caller deadline as caller-gave-up in LookupVolumeIds (#12151) * wdclient: treat an elapsed caller deadline as caller-gave-up on lookup errors gRPC can surface its own DeadlineExceeded a tick before ctx.Err() becomes visible, so a lookup that died on the caller's deadline was sporadically recorded as a filer failure (seen in the linux/386 job). * wdclient: reinterpret only deadline errors against an elapsed caller deadline --- weed/wdclient/filer_client.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/weed/wdclient/filer_client.go b/weed/wdclient/filer_client.go index b09bc303fc..98f1150144 100644 --- a/weed/wdclient/filer_client.go +++ b/weed/wdclient/filer_client.go @@ -788,8 +788,16 @@ func (p *filerVolumeProvider) LookupVolumeIds(ctx context.Context, volumeIds []s }() if err != nil { - // a caller that gave up says nothing about this filer - if ctxErr := ctx.Err(); ctxErr != nil { + // a caller that gave up says nothing about this filer; gRPC can + // surface its own DeadlineExceeded a tick before ctx.Err() + // becomes visible, so reinterpret only deadline errors this way + ctxErr := ctx.Err() + if ctxErr == nil && status.Code(err) == codes.DeadlineExceeded { + if dl, ok := ctx.Deadline(); ok && !dl.After(time.Now()) { + ctxErr = context.DeadlineExceeded + } + } + if ctxErr != nil { if lastErr != nil { return nil, fmt.Errorf("%w (earlier filer error: %v)", ctxErr, lastErr) }