diff --git a/go.sum b/go.sum index 3a8a710be..045c4e23a 100644 Binary files a/go.sum and b/go.sum differ diff --git a/pkg/local_object_storage/engine/evacuate.go b/pkg/local_object_storage/engine/evacuate.go index 81fe47e65..ea63cf3aa 100644 --- a/pkg/local_object_storage/engine/evacuate.go +++ b/pkg/local_object_storage/engine/evacuate.go @@ -7,6 +7,7 @@ import ( "strings" "sync" "sync/atomic" + "time" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" @@ -642,7 +643,27 @@ func (e *StorageEngine) evacuateObjects(ctx context.Context, sh *shard.Shard, to var getPrm shard.GetPrm getPrm.SetAddress(addr) - getRes, err := sh.Get(ctx, getPrm) + var getRes shard.GetRes + var err error + done := make(chan interface{}) + + go func() { + defer func() { + close(done) + }() + + getRes, err = sh.Get(ctx, getPrm) + }() + + timer := time.NewTimer(30 * time.Second) + select { + case <-ctx.Done(): + return ctx.Err() + case <-timer.C: + err = errors.New("failed to read object by timeout") + case <-done: + } + if err != nil { if prm.IgnoreErrors { res.objFailed.Add(1)