Skip to content

Commit

Permalink
store: fix chunk pool memory leak (#1512)
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Bursavich <[email protected]>
  • Loading branch information
abursavich authored and GiedriusS committed Sep 13, 2019
1 parent 83583f1 commit 42e9506
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1275,11 +1275,13 @@ func (b *bucketBlock) readChunkRange(ctx context.Context, seq int, off, length i

r, err := b.bucket.GetRange(ctx, b.chunkObjs[seq], off, length)
if err != nil {
b.chunkPool.Put(c)
return nil, errors.Wrap(err, "get range reader")
}
defer runutil.CloseWithLogOnErr(b.logger, r, "readChunkRange close range reader")

if _, err = io.Copy(buf, r); err != nil {
b.chunkPool.Put(c)
return nil, errors.Wrap(err, "read range")
}
internalBuf := buf.Bytes()
Expand Down

0 comments on commit 42e9506

Please sign in to comment.