From 4de3a853e572bc034cc87363463934dc833b8b00 Mon Sep 17 00:00:00 2001 From: "dominic.qi" Date: Thu, 22 Aug 2024 12:22:10 +0800 Subject: [PATCH] Store: Fix panic too smaller buffer Signed-off-by: dominic.qi --- CHANGELOG.md | 1 + pkg/store/bucket.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb976721d2..4e1e76512b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7592](https://github.com/thanos-io/thanos/pull/7592) Ruler: Only increment `thanos_rule_evaluation_with_warnings_total` metric for non PromQL warnings. - [#7614](https://github.com/thanos-io/thanos/pull/7614) *: fix debug log formatting. - [#7492](https://github.com/thanos-io/thanos/pull/7492) Compactor: update filtered blocks list before second downsample pass. +- [#7658](https://github.com/thanos-io/thanos/pull/7658) Store: Fix panic because too small buffer in pool. ### Added diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 957910d7f4..d9f6a3d4b2 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -3577,10 +3577,10 @@ func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, a bufPooled, err := r.block.chunkPool.Get(r.block.estimatedMaxChunkSize) if err == nil { buf = *bufPooled + defer r.block.chunkPool.Put(&buf) } else { buf = make([]byte, r.block.estimatedMaxChunkSize) } - defer r.block.chunkPool.Put(&buf) for i, pIdx := range pIdxs { // Fast forward range reader to the next chunk start in case of sparse (for our purposes) byte range.