diff --git a/CHANGELOG.md b/CHANGELOG.md index a1ea3d9713..0bbf1c31a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel ### Fixed - [#2411](https://github.com/thanos-io/thanos/pull/2411) Query: fix a bug where queries might not time out sometimes due to issues with one or more StoreAPIs +- [#2474](https://github.com/thanos-io/thanos/pull/2474) Store: fix a panic caused by concurrent memory access during block filtering. ## [v0.12.0](https://github.com/thanos-io/thanos/releases/tag/v0.12.0) - 2020.04.15 diff --git a/pkg/block/fetcher.go b/pkg/block/fetcher.go index 7f21d4d801..29d67735e2 100644 --- a/pkg/block/fetcher.go +++ b/pkg/block/fetcher.go @@ -550,6 +550,7 @@ var _ MetadataFilter = &DeduplicateFilter{} // Not go-routine safe. type DeduplicateFilter struct { duplicateIDs []ulid.ULID + mu sync.Mutex } // NewDeduplicateFilter creates DeduplicateFilter. @@ -603,11 +604,13 @@ func (f *DeduplicateFilter) filterForResolution(root *Node, metaSlice []*metadat duplicateULIDs := getNonRootIDs(root) for _, id := range duplicateULIDs { + f.mu.Lock() if metas[id] != nil { f.duplicateIDs = append(f.duplicateIDs, id) } synced.WithLabelValues(duplicateMeta).Inc() delete(metas, id) + f.mu.Unlock() } }