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
reader, nextChunkLen, err = mu.nextReader()
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
}
if nextChunkLen == 0 && partNumber > 0 {