-
Notifications
You must be signed in to change notification settings - Fork 630
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
cgroup: fix --manage-cgroups=ignore #1800
cgroup: fix --manage-cgroups=ignore #1800
Conversation
Codecov Report
@@ Coverage Diff @@
## criu-dev #1800 +/- ##
============================================
+ Coverage 68.90% 68.96% +0.05%
============================================
Files 128 128
Lines 33191 33194 +3
============================================
+ Hits 22871 22892 +21
+ Misses 10320 10302 -18
Continue to review full report at Codecov.
|
e6dd649
to
824b9c7
Compare
I don't agree that runsc or crun has to use --manage-cgroups=ignore. A container can have a local hierarchy that we need to restore. I think a proper use of --cgroup-root should fix the origin problem. |
You need to add a commit message for the test. It has to describe what test does. |
f221917
to
aedc3be
Compare
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
I can confirm that the patch in this PR fixes containers/podman#13672
4897c12
to
10d6512
Compare
Currently with the use of --manage-cgroups=soft we are using something which restores the container in the wrong cgroup. With
Sorry, I don't understand this.
Currently the container runtimes are moving the restored process into the cgroup after restore and that seems to work. |
It was my typo. I mean it can have a local hierarchy. Do you mount cgroups into a container? Can processes in a container create new cgroups? |
This works only in cases when processes in a container don't create cgroups... |
Probably yes, but so far no one seems to be using it in OCI containers, because until now I have not seen any reports of people complaining about non working cgroups inside of the container. During cgroup limits which are set during runtime of the container using |
Anyway, the fix for CRIU is to correctly work if What the container engine does is not really important here. |
10d6512
to
6d0b0b2
Compare
It works how it was designed by its author. It doesn't restore a cgroup tree, but it moves tasks in their cgroups. This behaviour was introduced in commit f95b05e:
Do we have uses that use this behaviour and whom new changes will break? I think the chance of breaking someone is low. |
No, I do not agree. According to the man page
With my patch that works. After restore the process is back in the current cgroup:
The ignore functionality is partially implemented currently but it is missing at two places. That is what my patch fixes. |
You can be disagree and it is what it is. The source of truth is the commit message and the code but not the man page that was written much later than the code. And I lean to accept this patch rather than introduce a new mode. |
When did we talk about a new mode? This is just about fixing the existing |
manage_cgroup as a boolean is deprecated and according to the source the right thing to do is |
Ahh! That must explain why my earlier use of |
I agree with @avagin, "ignore" should only mean that the container runtime is in charge of creating the whole container cgroup directory tree, but criu should still put processes it creates into same topology it had seen them on dump. In Virtuozzo criu when we migrate container with change of container ID we do dump it with something like Also note that in "soft" mode we don't restore cgroup options on root container cgroups if cgroup directories were pre-created by container environment, so container environment is in charge to put the same values there as was on dump. Using "full" mode solves it but requires some fixes, see e.g.: https://src.openvz.org/projects/OVZ/repos/criu/commits/6cab5493c59d699fdd231fd1ad6d808fe3bc2278 |
Independent of what the container runtime should do, |
Yeh probably you are right, proving hunks from the original patch:
Cgroup yard was never initialized for "ignore", so it was never possible to put tasks in right cgroups with "ignore". Please also apply this fix to you pr, so that "unified" does not convert to "unifie":
After this fix it is obvious that with "ignore" the fail happens as we always have -1 CGROUP_YARD service fd in userns_move. |
6d0b0b2
to
91af633
Compare
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.
Looks good.
91af633
to
6425209
Compare
pls remove the passage about oci containers from the commit message. It is not correlate directly with the patch. |
Actually, the commit message describes the problem we are trying to fix: containers/podman#13672 |
67a9557
to
d62380c
Compare
d62380c
to
4db6280
Compare
BTW @Snorch explained me that what I think the ignore mode means is actually covered by the none mode. |
The code expected that the cgroup directory ends with a ',' and unconditionally removes the last character. For the "unified" case this resulted in the last 'd' being remove instead of the non existing comma. This just adds a comma after "unified" so that the last removed character is not the 'd'. Suggested-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by: Adrian Reber <areber@redhat.com>
Using '--manage-cgroups=ignore' fails during restore. This fixes the use of '--manage-cgroups=ignore'. Signed-off-by: Adrian Reber <areber@redhat.com>
Test to ensure that --manage-cgroups=ignore works correctly. Signed-off-by: Adrian Reber <areber@redhat.com>
4db6280
to
bed20ce
Compare
Using
--manage-cgroups=ignore
was still trying to restore cgroup properties at certain places.Restoring a OCI container in a different cgroup (than the one it was checkpointed from) resulted in CRIU trying to put the container in the original cgroup but the container runtime (runc, crun) was putting it another cgroup. A second checkpoint of the container with two different cgroup settings did no longer work.
With this change CRIU really completely ignores the cgroup and the container can be checkpointed and restored multiple times even if the cgroup changes.
This PR includes a test to verify
--manage-cgroups=ignore'
works as expected.