-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pal cgroup v2 implementation #44990
Conversation
Fixes two issues in src/pal/src/misc/cgroup.cpp: * No subsystem match must be performed for cgroup v2. * Incorrect arguments for sscanf_s when reading cgroup path. The src/gc/unix/cgroup.cpp implementation doesn't have these issues.
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.
LGTM modulo the nit.
@tmds thank you for the fix! |
@janvorli can/should we backport this to 5.0? |
What is the observable impact of the bug? Who will be affected? Are there workarounds? |
There's related code in https://github.com/dotnet/runtime/blob/master/src/libraries/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs; anything similar need fixing there? |
On systems with cgroup v2, .NET isn't aware of the cpu/memory limit that is configured for the container. cgroup v2 is not wide-spread yet, but it gets adopted:
If this isn't backported, I think we'll be patching the packages we build for RHEL. Though we prefer to not do that.
This is ok, only for cgroup v1 the subsystem check is applied: runtime/src/libraries/Common/src/Interop/Linux/cgroups/Interop.cgroups.cs Lines 253 to 270 in e2312e1
|
I believe we should backport it. |
/backport to release/5.0 @janvorli, I'll let you fill in the details :) |
Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/374520406 |
@stephentoub thank you :-) |
@tmds, can you please share what level of testing have you done for the change? I need to summarize it in the porting request. |
@janvorli I ran this program in a container with using System;
namespace console
{
class Program
{
static void Main(string[] args)
{
while (true)
{
var buffer = new byte[1024];
}
}
}
} When I run it like this:
which doesn't use the change in ths PR, strace shows:
When I run it like this:
The change is included, and strace looks like:
When I don't set a memory limit, both look like the first strace. |
Fixes two issues in src/pal/src/misc/cgroup.cpp:
The src/gc/unix/cgroup.cpp implementation doesn't have these issues.
cc @janvorli @omajid