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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix deadlock caused by message chan blocked (#5639)
LHHDZ36b5b713ba04
diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.goindex b989da424e..91f69fef45 100644--- a/weed/server/master_grpc_server.go+++ b/weed/server/master_grpc_server.go@@ -292,6 +292,12 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ_, err := stream.Recv()if err != nil {glog.V(2).Infof("- client %v: %v", clientName, err)+ go func() {+ // consume message chan to avoid deadlock, go routine exit when message chan is closed+ for range messageChan {+ // no op+ }+ }()close(stopChan)return}@@ -367,6 +373,8 @@ func (ms *MasterServer) addClient(filerGroup, clientType string, clientAddress pfunc (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)ms.clientChansLock.Unlock()}