From 8ae6e47d9b66355022378f7c7c8a80341bffaa3a Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Thu, 19 Dec 2024 10:35:50 -0800 Subject: [PATCH] fix blockstore panic (#1570) --- pkg/filestore/blockstore_cache.go | 3 +++ pkg/wshutil/wshrpc.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/filestore/blockstore_cache.go b/pkg/filestore/blockstore_cache.go index f8608654b..ab48e7a83 100644 --- a/pkg/filestore/blockstore_cache.go +++ b/pkg/filestore/blockstore_cache.go @@ -227,6 +227,9 @@ func (entry *CacheEntry) readAt(ctx context.Context, offset int64, size int64, r offset += truncateAmt size -= truncateAmt } + if size <= 0 { + return realDataOffset, nil, nil + } } partMap := file.computePartMap(offset, size) dataEntryMap, err := entry.loadDataPartsForRead(ctx, getPartIdxsFromMap(partMap)) diff --git a/pkg/wshutil/wshrpc.go b/pkg/wshutil/wshrpc.go index 4bbbbd01e..24bb8d483 100644 --- a/pkg/wshutil/wshrpc.go +++ b/pkg/wshutil/wshrpc.go @@ -342,7 +342,10 @@ func (w *WshRpc) runServer() { continue } if msg.IsRpcRequest() { - go w.handleRequest(&msg) + go func() { + defer panichandler.PanicHandler("handleRequest:goroutine") + w.handleRequest(&msg) + }() } else { respCh := w.getResponseCh(msg.ResId) if respCh == nil {