From ca0ce4c6ef32195951fa2be8abb00d2fa2faf14a Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Tue, 2 Jul 2024 16:09:36 +0100 Subject: [PATCH] tests: Fix setting max openfds as memory limit (#20029) The code was advertenly passing max openfds to debug.SetMemoryLimit(), fixing this accelerate go test in my machine. This is only a testing bug, since the server context has always a valid MaxMem, so the buggy code was never called in users environments. --- cmd/server-rlimit.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/server-rlimit.go b/cmd/server-rlimit.go index 23946e0a0..ecb779e17 100644 --- a/cmd/server-rlimit.go +++ b/cmd/server-rlimit.go @@ -82,11 +82,7 @@ func setMaxResources(ctx serverCtxt) (err error) { } if ctx.MemLimit > 0 { - maxLimit = ctx.MemLimit - } - - if maxLimit > 0 { - debug.SetMemoryLimit(int64(maxLimit)) + debug.SetMemoryLimit(int64(ctx.MemLimit)) } // Do not use RLIMIT_AS as that is not useful and at times on systems < 4Gi