From 3e4f0c1eb908f3c5d34e3e516665358b31fa1b41 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 Oct 2021 17:33:51 +0300 Subject: [PATCH] [#674] object/put: Handle job submission errors Close wait channel on shard pool error in order to prevent deadlock. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/engine/put.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/engine/put.go b/pkg/local_object_storage/engine/put.go index c8d8e55a6..79a07514f 100644 --- a/pkg/local_object_storage/engine/put.go +++ b/pkg/local_object_storage/engine/put.go @@ -55,7 +55,7 @@ func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error) { exitCh := make(chan struct{}) - _ = pool.Submit(func() { + if err := pool.Submit(func() { defer close(exitCh) exists, err := s.Exists(existPrm) @@ -96,7 +96,10 @@ func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error) { } finished = true - }) + }); err != nil { + // TODO: log errors except ErrOverload when errors of util.WorkerPool will be documented + close(exitCh) + } <-exitCh