Repository navigation
Set DOTNET_PROCESSOR_COUNT=1 in the runtime image - #279
Merged
Merged
Conversation
Up to standards ✅🟢 Issues
|
lolgab
marked this pull request as ready for review
December 3, 2026 10:52
lolgab
enabled auto-merge (squash)
December 3, 2026 10:52
There was a problem hiding this comment.
Pull Request Overview
✅ No blocking issues noticed
No blocking findings were identified. The requested runtime configuration change has no conflicting code-review or quality findings.
Test suggestions
- Build the runtime image and verify the analyzer observes Environment.ProcessorCount as 1.
- Run the existing multiple-tests suite against the updated image.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Build the runtime image and verify the analyzer observes Environment.ProcessorCount as 1.
2. Run the existing multiple-tests suite against the updated image.
TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback
DMarinhoCodacy
approved these changes
Dec 3, 2026
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tool pods have a memory limit but no CPU limit, so cgroup
cpu.maxismaxand .NET'sEnvironment.ProcessorCountis every core of the node (16–64), not the pod's 1000m CPU request. The thread pool's minimum worker count isEnvironment.ProcessorCount, and the analyzer starts one task per file (CodeAnalyzer.Analyze+Task.WhenAll) while Roslyn runs analyzers withconcurrentAnalysis: trueon the same pool. On a large node that keeps many per-file compilations (each referencing the whole framework) alive at once, pushing the pod towards its 1300Mi limit, where the kernel kills it.DOTNET_PROCESSOR_COUNT=1, matching the 1000m CPU request.Environment.ProcessorCount, the thread pool minimum and Roslyn's parallelism all see 1 core, whatever the node size.mcr.microsoft.com/dotnet/runtime:6.0-alpine3.20), which readsDOTNET_PROCESSOR_COUNT: added in .NET 6 (clrconfigvalues.h, applied inGetCurrentProcessCpuCount; documented in the .NET 6Environment.ProcessorCountbreaking-change note).Not done on purpose: changing the per-file concurrency in
CodeAnalyzer. This PR only stops the runtime from sizing itself to the node.Same class of fix as codacy/codacy-opengrep#50.
plugins_test)ToolOutOfMemorycount vs before