From 682c2b46ab7775f528c0e658502f8eaa0c6aa5ba Mon Sep 17 00:00:00 2001 From: Vlad <13818348+walldiss@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:51:53 +0200 Subject: [PATCH] fix(store/cache): force close Accessor if not closed within timeout (#3642) --- share/eds/cache/accessor_cache.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/eds/cache/accessor_cache.go b/share/eds/cache/accessor_cache.go index a45c2542f8..e7ac043426 100644 --- a/share/eds/cache/accessor_cache.go +++ b/share/eds/cache/accessor_cache.go @@ -97,10 +97,12 @@ func (s *accessorWithBlockstore) close() error { done := s.done s.Unlock() + // wait until all references are released or timeout is reached. If timeout is reached, log an + // error and close the accessor forcefully. select { case <-done: case <-time.After(defaultCloseTimeout): - return fmt.Errorf("closing accessor, some readers didn't close the accessor within timeout,"+ + log.Errorf("closing accessor, some readers didn't close the accessor within timeout,"+ " amount left: %v", s.refs.Load()) } if err := s.shardAccessor.Close(); err != nil {