From ea3e03b6b1cadbc06b2ee375de5d2d8fa1ba20b3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Sat, 23 Nov 2024 15:57:20 +0300 Subject: [PATCH] object/put: fix concurrent PUT data corruption If ants pool is busy and cannot take task, early `return` without `wg.Wait()` leads to `iterateNodesForObject`'s `return` and all the buffers for binary replication from now may be reused while are still in use by the other routines inside the pool. Wait for WG before any `return` is called. Closes #2978, closes #2988, closes #2975, closes #2971. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/services/object/put/distributed.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d40f0669ef..83de5429bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ attribute, which is used for container domain name in NNS contracts (#2954) - Panic in event listener related to inability to switch RPC node (#2970) - Non-container nodes never check placement policy on PUT, SEARCH requests (#3014) - If shards are overloaded with PUT requests, operation is not skipped but waits for 30 seconds (#2871) +- Data corruption if PUT is done too concurrently (#2978) ### Changed - `ObjectService`'s `Put` RPC handler caches up to 10K lists of per-object sorted container nodes (#2901) diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index 476bad12e7..5a6d21552c 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -331,6 +331,7 @@ func (x placementIterator) iterateNodesForObject(obj oid.ID, f func(nodeDesc) er if e, _ := lastRespErr.Load().(error); e != nil { err = fmt.Errorf("%w (last node error: %w)", err, e) } + wg.Wait() return errIncompletePut{singleErr: err} } }