fix: prevent MiniClusterCtx race conditions in command shutdown
Capture global MiniClusterCtx into local variables before goroutine/select evaluation to prevent nil dereference/data race when context is reset to nil after nil check. Applied to filer, master, volume, and s3 commands.
This commit is contained in:
@@ -311,8 +311,9 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
|
||||
ms.Topo.HashicorpRaft.LeadershipTransfer()
|
||||
}
|
||||
})
|
||||
if MiniClusterCtx != nil {
|
||||
<-MiniClusterCtx.Done()
|
||||
ctx := MiniClusterCtx
|
||||
if ctx != nil {
|
||||
<-ctx.Done()
|
||||
ms.Shutdown()
|
||||
grpcS.Stop()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user