-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
unable to set memory limit to 20971520 (current usage: 21401600, peak usage: 21536768): unknown #3986
Comments
Sorry, The above description is wrong. |
I have done some tests. Maybe depends on go's version. Which version of golang did you use when you saw this problem? |
I'm using Go version 1.19.6. Let me switch to version 1.20+ and try again. Thank you. |
I switched the Go version to 1.20.7, but the problem still persists. Warning FailedStart 7s kubelet Error: failed to create containerd task: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: unable to set memory limit to 20971520 (current usage: 23396352, peak usage: 23408640): unknown |
I'm not sure if the cgroup configuration for What pre-start or create-runtime hooks are you running? It should be noted that the cgroup configuration didn't fail when the process was first configured, so there's something weird going on here. It should also be noted that the memory limit doesn't make sense -- we are just setting the same limit twice and yet the container is using more memory than the limit? Is the original limit a soft limit somehow? |
I check the config.json, there is a prestart hook "hooks": {
"prestart": [{
"path": "/var/lib/docker/hooks/remount_sys.sh",
"args": ["remount_sys.sh"]
}]
}, The script has configured devices.allow, and I'm not sure if it's related to this issue. |
This comment was marked as duplicate.
This comment was marked as duplicate.
This point also confuses me. How can we confirm whether the original limit is using a soft limit? I think it's highly unlikely that it is. |
The cgroups setup is split between Apply (which no longer does Set, but merely creates a cgroup and adds a pid to it) and Set (which actually sets the limits). From the cursory look at the code, we do need to call Set here. OTOH it looks like we call Set (and run CreateRuntime hook) twice in case we're running in host mount namespace, and I can't figure out why. Alas, I see no integration tests related to host mntns. Anyway, this is orthogonal to this issue. |
Addressed by #3996. |
Do you need me to provide any additional information? |
Well, it is clear what's happening -- higher memory usage due to switching from bindfd to memfd. This is being addressed in #3987. If you want to use current runc HEAD, the workaround is to raise the memory limits. |
I think there are still some points that we haven't analyzed clearly, according to the previous analysis memfd will only consume the host's memory, not the container's memory. So theoretically, if the host memory is sufficient, switching from bindfd to memfd should not cause the container to fail to start. |
@113xiaoji #3987 has been merged, could you please test it to see whether you can reproduce your issue in the main branch or not. Thanks. |
OK i will reproduce later |
I have tested it with the latest main branch, without adding the runc_nodmz tag, and the issue wasn’t reproduced. However, what confuses me is that the preceding memfd indeed occupied the memory of the container? |
✌️ Thanks.
Yes, this question still has no answer at this time. |
Description
When using logic from #3931, we discarded bindfd and adopted memfd. The pod has two containers: a main container and a sidecar. The request for the sidecar container is set to 10Mb and limit is 20MB. When I attempt to delete the pod and rebuild it, I face the following error:
Steps to reproduce the issue
Alternatively, when used with Kubernetes:
The pod has two containers: a primary container and a sidecar. The request for the sidecar container is set to 10Mb and the limit is 20MB. When I delete the pod, I wait for the pod to be rebuilt.
Describe the results you received and expected
Error Log:
code
code
Upon checking
move_charge_at_immigrate
, it's not enabled, and I'm oncgroupv1
.Upon examining the kernel 4.18 source code:
For cgroupv2 version, the code directly returns 0:
If
move_charge_at_immigrate=0
, it directly returns 0 as well:The issue disappears when I switch back to
runc 1.1.2
or use thememfd-bind
binary.Question 1: At that time, what was consuming the memory?
memfd
shouldn't consume the container's memory.@lifubang @cyphar
What version of runc are you using?
master
Host OS information
NAME="EulerOS"
VERSION="2.0 (SP10x86_64)"
ID="euleros"
VERSION_ID="2.0"
PRETTY_NAME="EulerOS 2.0 (SP10x86_64)"
ANSI_COLOR="0;31"
Host kernel information
Linux PaaSOM-1 4.18.0-147.5.2.14.h1050.eulerosv2r10.x86_64 #1 SMP Sun Oct 16 18:12:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: