Skip to content

Commit

Permalink
storage/blob/s3: Fix PutObject goroutines leaking if message write is…
Browse files Browse the repository at this point in the history
… aborted

See #395.
  • Loading branch information
foxcpp committed Aug 27, 2021
1 parent 34a8c68 commit 07c8495
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/storage/blob/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ func (b *s3blob) Write(p []byte) (n int, err error) {
}

func (b *s3blob) Close() error {
if !b.didSync {
b.pw.CloseWithError(fmt.Errorf("storage.blob.s3: blob closed without Sync"))
}
return nil
}

Expand All @@ -120,7 +123,10 @@ func (s *Store) Create(key string) (module.Blob, error) {
errCh <- err
}()

return &s3blob{pw: pw, errCh: errCh}, nil
return &s3blob{
pw: pw,
errCh: errCh,
}, nil
}

func (s *Store) Open(key string) (io.ReadCloser, error) {
Expand Down

0 comments on commit 07c8495

Please sign in to comment.