From 9a7c7ab2d0a716ea4e5f7ec00834ca79e8a307f3 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Wed, 28 Feb 2024 23:52:20 +0100 Subject: [PATCH] fix: parsing v2 and v1 cgroup memory limit (#19153) Trim the newline at the end of the sysfs memory limit. --- cmd/handler-api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/handler-api.go b/cmd/handler-api.go index e344095da..f15690e29 100644 --- a/cmd/handler-api.go +++ b/cmd/handler-api.go @@ -22,6 +22,7 @@ import ( "os" "runtime" "strconv" + "strings" "sync" "time" @@ -70,7 +71,7 @@ func cgroupMemLimit() (limit uint64) { if err != nil { return 0 } - limit, err = strconv.ParseUint(string(buf), 10, 64) + limit, err = strconv.ParseUint(strings.TrimSpace(string(buf)), 10, 64) if err != nil { // The kernel can return valid but non integer values // but still, no need to interpret more