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
This commit is contained in:
Chris Lu authored and GitHub committed 2026-10-28 00:35:52 -07:00
1 parent 67ce9a5f6d
commit a2863bf83b
1 file changed
+10 -2
+10 -2
View File
@@ -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)
}