From 411483bbc7d7cf950a0395d1fff4f213ca8a0f87 Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Wed, 14 Aug 2019 20:03:22 +0200 Subject: [PATCH] storage: fix LazyChunkReader.join potential deadlock --- storage/chunker.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/chunker.go b/storage/chunker.go index 59b72b7896..9f6db81c9f 100644 --- a/storage/chunker.go +++ b/storage/chunker.go @@ -540,6 +540,7 @@ func (r *LazyChunkReader) join(ctx context.Context, b []byte, off int64, eoff in case errC <- fmt.Errorf("chunk %v-%v not found; key: %s", off, off+treeSize, fmt.Sprintf("%x", childAddress)): case <-quitC: } + wg.Done() return } metrics.GetOrRegisterResettingTimer("lcr.getter.get", nil).UpdateSince(startTime) @@ -548,6 +549,7 @@ func (r *LazyChunkReader) join(ctx context.Context, b []byte, off int64, eoff in case errC <- fmt.Errorf("chunk %v-%v incomplete; key: %s, data length %v", off, off+treeSize, fmt.Sprintf("%x", childAddress), l): case <-quitC: } + wg.Done() return } if soff < off {