mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: missing cleanup of tmp folders in NAS gateway setup (#13124)
console service should be shutdown last once all shutdown sequences are complete, this is to ensure that we do not prematurely kill the server before it cleans up the `.minio.sys/tmp/uuid` folder. NOTE: this only applies to NAS gateway setup.
This commit is contained in:
parent
72a288f73f
commit
f89d0f68d0
@ -345,18 +345,14 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if globalBrowserEnabled {
|
if globalBrowserEnabled {
|
||||||
consoleSrv, err := initConsoleServer()
|
globalConsoleSrv, err = initConsoleServer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.FatalIf(err, "Unable to initialize console service")
|
logger.FatalIf(err, "Unable to initialize console service")
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-globalOSSignalCh
|
logger.FatalIf(globalConsoleSrv.Serve(), "Unable to initialize console server")
|
||||||
consoleSrv.Shutdown()
|
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
consoleSrv.Serve()
|
|
||||||
} else {
|
|
||||||
<-globalOSSignalCh
|
<-globalOSSignalCh
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/console/restapi"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/minio/internal/bucket/bandwidth"
|
"github.com/minio/minio/internal/bucket/bandwidth"
|
||||||
"github.com/minio/minio/internal/handlers"
|
"github.com/minio/minio/internal/handlers"
|
||||||
@ -315,6 +316,8 @@ var (
|
|||||||
|
|
||||||
globalTierJournal *tierJournal
|
globalTierJournal *tierJournal
|
||||||
|
|
||||||
|
globalConsoleSrv *restapi.Server
|
||||||
|
|
||||||
globalDebugRemoteTiersImmediately []string
|
globalDebugRemoteTiersImmediately []string
|
||||||
// Add new variable global values here.
|
// Add new variable global values here.
|
||||||
)
|
)
|
||||||
|
@ -1453,6 +1453,9 @@ func (sys *NotificationSys) GetBandwidthReports(ctx context.Context, buckets ...
|
|||||||
|
|
||||||
// GetClusterMetrics - gets the cluster metrics from all nodes excluding self.
|
// GetClusterMetrics - gets the cluster metrics from all nodes excluding self.
|
||||||
func (sys *NotificationSys) GetClusterMetrics(ctx context.Context) chan Metric {
|
func (sys *NotificationSys) GetClusterMetrics(ctx context.Context) chan Metric {
|
||||||
|
if sys == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
g := errgroup.WithNErrs(len(sys.peerClients))
|
g := errgroup.WithNErrs(len(sys.peerClients))
|
||||||
peerChannels := make([]<-chan Metric, len(sys.peerClients))
|
peerChannels := make([]<-chan Metric, len(sys.peerClients))
|
||||||
for index := range sys.peerClients {
|
for index := range sys.peerClients {
|
||||||
|
@ -582,20 +582,17 @@ func serverMain(ctx *cli.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if globalBrowserEnabled {
|
if globalBrowserEnabled {
|
||||||
consoleSrv, err := initConsoleServer()
|
globalConsoleSrv, err = initConsoleServer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.FatalIf(err, "Unable to initialize console service")
|
logger.FatalIf(err, "Unable to initialize console service")
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
logger.FatalIf(consoleSrv.Serve(), "Unable to initialize console server")
|
logger.FatalIf(globalConsoleSrv.Serve(), "Unable to initialize console server")
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
<-globalOSSignalCh
|
<-globalOSSignalCh
|
||||||
consoleSrv.Shutdown()
|
|
||||||
} else {
|
|
||||||
<-globalOSSignalCh
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
||||||
|
@ -66,6 +66,10 @@ func handleSignals() {
|
|||||||
logger.LogIf(context.Background(), oerr)
|
logger.LogIf(context.Background(), oerr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalConsoleSrv != nil {
|
||||||
|
logger.LogIf(context.Background(), globalConsoleSrv.Shutdown())
|
||||||
|
}
|
||||||
|
|
||||||
return (err == nil && oerr == nil)
|
return (err == nil && oerr == nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user