Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Fix panic (#5654)

Gaspare Iengodc6b75042473
diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go
index c8fe053fae..0a7bd5ef2e 100644
--- a/weed/server/master_grpc_server.go
+++ b/weed/server/master_grpc_server.go
@@ -373,8 +373,10 @@ func (ms *MasterServer) deleteClient(clientName string) {
glog.V(0).Infof("- client %v", clientName)
ms.clientChansLock.Lock()
// close message chan, so that the KeepConnected go routine can exit
- close(ms.clientChans[clientName])
- delete(ms.clientChans, clientName)
+ if clientChan, ok := ms.clientChans[clientName]; ok {
+ close(clientChan)
+ delete(ms.clientChans, clientName)
+ }
ms.clientChansLock.Unlock()
}