Description
If iterate in CompressObjects returns an error:
pool.Queue(func(ctx context.Context) error { //nolint:errcheck |
if err := iterate(ctx, opts, zipWriter); err != nil { |
return fmt.Errorf("could not iterate through objects: %w", err) |
}
|
|
if err := zipWriter.Close(); err != nil { |
return fmt.Errorf("could not close zip writer: %w", err) |
}
|
|
if err := w.Close(); err != nil { |
return fmt.Errorf("could not close pipe writer: %w", err) |
}
|
|
return nil |
})
|
then the code will return before zipWriter calls Close(), meaning the upload thread will block on this line, waiting for something to be written to zipWriter:
pos, readErr := io.ReadFull(reader, slice)
|
To fix this, zipWriter and w should be closed when iterate returns an error.
Attachments
For Gerrit Dashboard: MB-55967 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
188374,6 | MB-55967 Fix improper error handling | master | tools-common | Status: MERGED | +2 | +1 |