Skip to content

Commit

Permalink
s3blob: fix data race (#3480)
Browse files Browse the repository at this point in the history
w.pr cannot be used to indicate that the pipe has been closed. The problem with
using w.pr is that a write to it in the goroutine launched by writer.open can
race with a read on w.pr in Close.

We just don't write to w.pr in writer.open. The read end of the pipe can still be
closed twice, but that's fine.
  • Loading branch information
arjunnair1997 authored Aug 29, 2024
1 parent bb796f8 commit 2d0cce5
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion blob/s3blob/s3blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ func (w *writer) open(r io.Reader, closePipeOnError bool) {
if err != nil {
if closePipeOnError {
w.pr.CloseWithError(err)
w.pr = nil
}
w.err = err
}
Expand Down

0 comments on commit 2d0cce5

Please sign in to comment.