Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: openshift/release
Length of output: 4393
🏁 Script executed:
Repository: openshift/release
Length of output: 8786
🏁 Script executed:
Repository: openshift/release
Length of output: 5751
🌐 Web query:
Go runtime GOMEMLIMIT soft memory limit runtime can exceed documentation💡 Result:
The Go runtime's GOMEMLIMIT environment variable is explicitly defined as a soft memory limit, meaning the runtime does not guarantee memory usage will remain below this value [1][2]. While the runtime makes a reasonable effort to keep memory usage under the limit by increasing garbage collection (GC) frequency and intensity, it may exceed this limit under certain conditions [1][3]. Key reasons why GOMEMLIMIT can be exceeded include: 1. GC CPU Limiting: To prevent performance degradation known as "thrashing," the Go runtime caps the amount of CPU time the GC can use to approximately 50% of available CPU resources [1][3]. If the memory limit cannot be maintained within this CPU budget, the GC will prioritize completing its work without exceeding the CPU cap, allowing the Go program to continue allocating memory and exceeding the soft limit [1][3]. 2. Non-Go Managed Memory: GOMEMLIMIT only accounts for memory managed by the Go runtime (e.g., the Go heap) [4][5]. It excludes external memory sources such as memory used by CGO, binary mappings, stack memory for OS threads, and other memory held by the operating system on behalf of the program [4][5]. If these external memory sources grow, the process's total RSS (Resident Set Size) may exceed the GOMEMLIMIT even if the Go heap remains within its target [3][6]. 3. Unachievable Limits: If the program's "live heap" (the minimum memory required to hold reachable objects) plus essential runtime overhead already exceeds the configured GOMEMLIMIT, the runtime cannot maintain the limit, and memory usage will necessarily surpass it [3][2]. In production environments, it is recommended to set GOMEMLIMIT to roughly 10–15% below the hard container or system memory limit to account for these non-Go-managed memory sources and to provide headroom for the garbage collector to operate [3][2]. If the limit is set too low relative to the application's needs, it can lead to constant, ineffective GC cycles, causing high CPU usage without successfully keeping memory usage under the limit [3][6].
Citations:
Align
GOMEMLIMITwith the new container limit.The
ephemeral-clustercontainer has a16Gihard limit, butGOMEMLIMITremains8GiB.GOMEMLIMITis a soft Go runtime target. If the controller requires more than8GiBof Go-managed memory, the runtime can enter excessive GC or exceed the soft limit. Set a tested value below16Giwith headroom for non-Go memory, or document why8GiBis intentional.🧰 Tools
🪛 Checkov (3.3.10)
[medium] 1-101: Containers should not run with allowPrivilegeEscalation
(CKV_K8S_20)
[medium] 1-101: Minimize the admission of root containers
(CKV_K8S_23)
🤖 Prompt for AI Agents