From 1451b389a4a78e7ec90aa931c9e8ac2b711f6408 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 13 Jul 2022 00:58:15 -0700 Subject: [PATCH] Avoid fatal error: sync: Unlock of unlocked RWMutex fix https://github.com/chrislusf/seaweedfs/issues/3306 --- weed/filer/reader_cache.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/filer/reader_cache.go b/weed/filer/reader_cache.go index c319f6c78..4c92f71c8 100644 --- a/weed/filer/reader_cache.go +++ b/weed/filer/reader_cache.go @@ -18,7 +18,7 @@ type ReaderCache struct { } type SingleChunkCacher struct { - sync.RWMutex + sync.Mutex cond *sync.Cond parent *ReaderCache chunkFileId string @@ -183,8 +183,8 @@ func (s *SingleChunkCacher) destroy() { } func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) { - s.RLock() - defer s.RUnlock() + s.Lock() + defer s.Unlock() for s.completedTime.IsZero() { s.cond.Wait()