From a70f001e266e7af751bc65e3acdd6b955c1fa92c Mon Sep 17 00:00:00 2001 From: chrislusf Date: Wed, 28 Oct 2026 00:24:16 -0700 Subject: [PATCH] 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). --- 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..cdde013097 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; check the + // deadline too since gRPC can report its own DeadlineExceeded a + // tick before ctx.Err() becomes visible + ctxErr := ctx.Err() + if ctxErr == nil { + 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) }