diff --git a/cmd/common-main.go b/cmd/common-main.go index 5078355f4..5137a214f 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -21,6 +21,7 @@ import ( "encoding/gob" "errors" "fmt" + "math/rand" "net" "net/url" "os" @@ -33,6 +34,7 @@ import ( "github.com/minio/cli" "github.com/minio/minio-go/v7/pkg/set" "github.com/minio/minio/cmd/config" + xhttp "github.com/minio/minio/cmd/http" "github.com/minio/minio/cmd/logger" "github.com/minio/minio/pkg/auth" "github.com/minio/minio/pkg/certs" @@ -43,6 +45,9 @@ func init() { logger.Init(GOPATH, GOROOT) logger.RegisterError(config.FmtError) + rand.Seed(time.Now().UTC().UnixNano()) + globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second) + gob.Register(StorageErr("")) } diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index 7e7187d4c..563035e3d 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -19,14 +19,12 @@ package cmd import ( "context" "fmt" - "math/rand" "net" "net/url" "os" "os/signal" "strings" "syscall" - "time" "github.com/gorilla/mux" "github.com/minio/cli" @@ -155,9 +153,6 @@ func ValidateGatewayArguments(serverAddr, endpointAddr string) error { // StartGateway - handler for 'minio gateway '. func StartGateway(ctx *cli.Context, gw Gateway) { - rand.Seed(time.Now().UTC().UnixNano()) - - globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second) defer globalDNSCache.Stop() // This is only to uniquely identify each gateway deployments. diff --git a/cmd/server-main.go b/cmd/server-main.go index f2b47e515..1d58e610f 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -20,7 +20,6 @@ import ( "context" "errors" "fmt" - "math/rand" "net" "os" "os/signal" @@ -362,9 +361,6 @@ func initAllSubsystems(ctx context.Context, newObject ObjectLayer) (err error) { // serverMain handler called for 'minio server' command. func serverMain(ctx *cli.Context) { - rand.Seed(time.Now().UTC().UnixNano()) - - globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second) defer globalDNSCache.Stop() signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) diff --git a/pkg/dsync/drwmutex.go b/pkg/dsync/drwmutex.go index 4195e2713..c0ac024ce 100644 --- a/pkg/dsync/drwmutex.go +++ b/pkg/dsync/drwmutex.go @@ -33,7 +33,6 @@ var dsyncLog bool func init() { // Check for MINIO_DSYNC_TRACE env variable, if set logging will be enabled for failed REST operations. dsyncLog = os.Getenv("MINIO_DSYNC_TRACE") == "1" - rand.Seed(time.Now().UnixNano()) } func log(format string, data ...interface{}) {