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

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

storage/http_client.go

Lines changed: 2 additions & 1 deletion
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)