Skip to content

Commit

Permalink
fix(storage): wait for XML read req to finish to avoid data races (#1…
Browse files Browse the repository at this point in the history
…1527)

Fixes TestRetryReadStallEmulated failing with `-race`
  • Loading branch information
BrennaEpp authored Jan 29, 2025
1 parent c2f9f6b commit 782e12a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 +946,11 @@ func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRa
case <-timer:
log.Printf("stalled read-req (%p) cancelled after %fs", req, stallTimeout.Seconds())
cancel()
err = context.DeadlineExceeded
<-done
if res != nil && res.Body != nil {
res.Body.Close()
}
return res, context.DeadlineExceeded
case <-done:
cancel = nil
}
Expand Down

0 comments on commit 782e12a

Please sign in to comment.