From d1d123d180a27885ebf4fba7ef4504ea2cfaec6c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 14 Feb 2023 09:23:24 +0300 Subject: [PATCH] [#2234] writecache: Fix possible panic in `initFlushMarks` In case we have many small objects in the write-cache, `indices` should not be reused between iterations. Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/local_object_storage/writecache/init.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 289725feb..f4e8430bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Changelog for FrostFS Node - Fix `*_req_count` and `*_req_count_success` metric values (#2241) - Storage ID update by write-cache (#2244) - `neo-go` client deadlock on subscription restoration (#2244) +- Possible panic during write-cache initialization (#2234) ### Removed ### Updated diff --git a/pkg/local_object_storage/writecache/init.go b/pkg/local_object_storage/writecache/init.go index fbcc455c0..2c8bcf9c8 100644 --- a/pkg/local_object_storage/writecache/init.go +++ b/pkg/local_object_storage/writecache/init.go @@ -46,6 +46,7 @@ func (c *cache) initFlushMarks() { var batchSize = flushBatchSize for { m = m[:0] + indices = indices[:0] // We put objects in batches of fixed size to not interfere with main put cycle a lot. _ = c.db.View(func(tx *bbolt.Tx) error {