Skip to content

Commit

Permalink
cloud: close Reader before resetting in ResumingReader
Browse files Browse the repository at this point in the history
This change `Close()`s the Reader before resetting it when we
encounter a resumable error in the ResumingReader. This is particularly
important for the http external storage provide, since forgetting to
call Close() results in goroutine leaks from go1.17.6 onwards.

See: golang/go#50652

Release note: None
  • Loading branch information
adityamaru committed Jan 19, 2022
1 parent bed5b79 commit bea8127
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cloud/cloud_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ func (r *ResumingReader) Read(p []byte) (int, error) {
}
log.Errorf(r.Ctx, "Retry IO: error %s", lastErr)
lastErr = nil
if r.Reader != nil {
r.Reader.Close()
}
r.Reader = nil
}
}
Expand Down

0 comments on commit bea8127

Please sign in to comment.