[release/10.0] Fix cgroup v2 memory max extraction#130404
Merged
Merged
Conversation
In the edge case when the current process is assigned to the root cgroup, the hierarchical memory limit extraction goes past the root cgroup hierarchy mount path and the process ends up crashing. This was discovered in google colab environment when attempting to run NativeAOT application in a jupyter notebook Close #130092
Contributor
|
Tagging subscribers to this area: @anicka-net, @dotnet/gc |
mangod9
approved these changes
Jul 9, 2026
Open
3 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.
Backport of #130377 to release/10.0
/cc @janvorli
Customer Impact
This issue prevents running .NET apps (both coreclr and NativeAOT) on Linux environments where the current process is assigned to cgroup that is the root of the cgroup hierarchy for the current cgroup mount and cgroup v2 is being used on the target device. It results in a crash (access violation) during app startup.
This was discovered in Google Colab environment when attempting to run NativeAOT application in a jupyter notebook.
Regression
Testing
Verified by running a simple .NET app compiled as NativeAOT in the Google Colab environment. It crashes without this fix and works fine with it. During testing, I've added extra printf logging to the cgroup info extraction code to make sure it is doing the right thing.
Risk
Low. The fix just ensures that we exit the cgroup hierarchy scan loop when we reach the mount root and that we process the memory.max file at this folder if it exists.