From 5ad032826a966a4f82319bb251a1b5ebdcff4dea Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 18 Sep 2020 02:03:02 -0700 Subject: [PATCH] Add a reasonable if unable to get total RAM (#10506) Though unlikely we shouldn't skip initializing the API if we cannot get RAM. Add 16GiB as a default and log the error. --- cmd/handler-api.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/handler-api.go b/cmd/handler-api.go index be86d4960..8b4ecc021 100644 --- a/cmd/handler-api.go +++ b/cmd/handler-api.go @@ -22,6 +22,7 @@ import ( "time" "github.com/minio/minio/cmd/config/api" + "github.com/minio/minio/cmd/logger" "github.com/minio/minio/pkg/sys" ) @@ -45,7 +46,9 @@ func (t *apiConfig) init(cfg api.Config, setDriveCount int) { if cfg.RequestsMax <= 0 { stats, err := sys.GetStats() if err != nil { - return + logger.LogIf(GlobalContext, err) + // Default to 16 GiB, not critical. + stats.TotalRAM = 16 << 30 } // max requests per node is calculated as // total_ram / ram_per_request