From 452202f35b9e16bf00cdaf995a6e347eda367ce2 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Mon, 24 Oct 2022 02:00:28 +0500 Subject: [PATCH] ReadNeedleMeta recovery panic occurred (#3883) ReadNeedleMeta panic occurred https://github.com/seaweedfs/seaweedfs/issues/3882 --- weed/storage/needle/needle_read_page.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/storage/needle/needle_read_page.go b/weed/storage/needle/needle_read_page.go index 4e7edfb31..8dde43701 100644 --- a/weed/storage/needle/needle_read_page.go +++ b/weed/storage/needle/needle_read_page.go @@ -1,6 +1,7 @@ package needle import ( + "fmt" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/storage/backend" . "github.com/seaweedfs/seaweedfs/weed/storage/types" @@ -30,6 +31,11 @@ func (n *Needle) ReadNeedleData(r backend.BackendStorageFile, volumeOffset int64 // ReadNeedleMeta fills all metadata except the n.Data func (n *Needle) ReadNeedleMeta(r backend.BackendStorageFile, offset int64, size Size, version Version) (err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic occurred: %+v", r) + } + }() bytes := make([]byte, NeedleHeaderSize+DataSizeSize)