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: prevent MiniClusterCtx race conditions in command shutdown
Chris Luc106532b7924
diff --git a/weed/command/filer.go b/weed/command/filer.goindex 8db4f8c859..3cc69ccf2a 100644--- a/weed/command/filer.go+++ b/weed/command/filer.go@@ -483,8 +483,9 @@ func (fo *FilerOptions) startFiler() {}httpS := newHttpServer(defaultMux, tlsConfig)if MiniClusterCtx != nil {+ ctx := MiniClusterCtxgo func() {- <-MiniClusterCtx.Done()+ <-ctx.Done()httpS.Shutdown(context.Background())grpcS.Stop()}()@@ -502,8 +503,9 @@ func (fo *FilerOptions) startFiler() {}httpS := newHttpServer(defaultMux, nil)if MiniClusterCtx != nil {+ ctx := MiniClusterCtxgo func() {- <-MiniClusterCtx.Done()+ <-ctx.Done()httpS.Shutdown(context.Background())grpcS.Stop()}()diff --git a/weed/command/master.go b/weed/command/master.goindex 2ed59ce652..2a7511fbf2 100644--- a/weed/command/master.go+++ b/weed/command/master.go@@ -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 {diff --git a/weed/command/s3.go b/weed/command/s3.goindex db62e6e1c8..625faa14e5 100644--- a/weed/command/s3.go+++ b/weed/command/s3.go@@ -408,8 +408,9 @@ func (s3opt *S3Options) startS3Server() bool {}httpS := newHttpServer(router, tlsConfig)if MiniClusterCtx != nil {+ ctx := MiniClusterCtxgo func() {- <-MiniClusterCtx.Done()+ <-ctx.Done()httpS.Shutdown(context.Background())grpcS.Stop()}()diff --git a/weed/command/volume.go b/weed/command/volume.goindex 4e6311c9d8..601849f285 100644--- a/weed/command/volume.go+++ b/weed/command/volume.go@@ -319,10 +319,11 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, vstopChan <- true})- if MiniClusterCtx != nil {+ ctx := MiniClusterCtx+ if ctx != nil {select {case <-stopChan:- case <-MiniClusterCtx.Done():+ case <-ctx.Done():shutdown(publicHttpDown, clusterHttpServer, grpcS, volumeServer)}} else {