Skip to content

Commit 782e12a

Browse files
authored
fix(storage): wait for XML read req to finish to avoid data races (#11527)
Fixes TestRetryReadStallEmulated failing with `-race`
1 parent c2f9f6b commit 782e12a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

storage/http_client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -946,10 +946,11 @@ func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRa
946946
case <-timer:
947947
log.Printf("stalled read-req (%p) cancelled after %fs", req, stallTimeout.Seconds())
948948
cancel()
949-
err = context.DeadlineExceeded
949+
<-done
950950
if res != nil && res.Body != nil {
951951
res.Body.Close()
952952
}
953+
return res, context.DeadlineExceeded
953954
case <-done:
954955
cancel = nil
955956
}

0 commit comments

Comments
 (0)