From dc6b75042473b33c5f2fadc2174f1661fbfe4d5d Mon Sep 17 00:00:00 2001 From: Gaspare Iengo Date: Fri, 7 Jun 2024 01:59:50 +0000 Subject: [PATCH] Fix panic (#5654) --- weed/server/master_grpc_server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go index c8fe053fa..0a7bd5ef2 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() }