qingstor: fix go routine leak on multipart upload errors - fixes #2851

This commit is contained in:
Nick Craig-Wood 2019-01-03 18:54:47 +00:00
parent 39f5059d48
commit 9685be64cd

View file

@ -392,6 +392,14 @@ func (mu *multiUploader) multiPartUpload(firstBuf io.ReadSeeker) error {
var nextChunkLen int var nextChunkLen int
reader, nextChunkLen, err = mu.nextReader() reader, nextChunkLen, err = mu.nextReader()
if err != nil && err != io.EOF { if err != nil && err != io.EOF {
// empty ch
go func() {
for range ch {
}
}()
// Wait for all goroutines finish
close(ch)
mu.wg.Wait()
return err return err
} }
if nextChunkLen == 0 && partNumber > 0 { if nextChunkLen == 0 && partNumber > 0 {