Skip to content
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 init.scope in cgroup paths #966

Merged
merged 1 commit into from
Aug 1, 2016

Conversation

sjenning
Copy link
Contributor

@sjenning sjenning commented Jul 26, 2016

Fixes #931

There was talk in the issue about using dbus to determine which cgroup contains systemd, but I'm not seeing how that is relevant. Seems like we just want to always start at the cgroup root.

@derekwaynecarr @vishh @euank @mrunalp

@euank
Copy link
Contributor

euank commented Jul 26, 2016

The hardcoded string system.slice is what you'd use a systemd dbus call to replace iiuc.

All the same, LGTM as a definite improvement over the existing state of things. Thanks!

@cyphar
Copy link
Member

cyphar commented Jul 26, 2016

Rejected.

The reason why we do this is because of the usecase where someone is running a container inside a container (currently we don't have support for the cgroup namespace, and there's no requirement that a user will use that namespace even if we did support it -- see #781). If you start joining cgroups at the root, things start to not go very well (systemd can't track the process anymore and it doesn't like that very much).

Now, for the apply_raw cgroup handler we check against /proc/1/cgroups but if you tell runC to specifically use systemd for cgroup handling that's what we will do instead.

The issue you linked references that we should be using systemd to query the root of the cgroup hierarchy, not to ignore systemd in the systemd cgroup driver. I'd be okay with a change that does that.

/cc @crosbymichael

Rejected with PullApprove

@sjenning
Copy link
Contributor Author

@cyphar thanks for explaining that. I have pushed a different possible fix.

The idea is that if "init.scope" is in the initPath, we should remove it, and it will only every appear once at the end of the initPath. If pid 1 is not systemd, nothing changes. If pid 1 is systemd < 226, nothing changes. If pid 1 is systemd >= 226, "init.scope" is removed from the initPath.

Does this work?

@mrunalp
Copy link
Contributor

mrunalp commented Jul 27, 2016

@sjenning This sounds good to me. IMO, this is the least intrusive fix for now.

@mrunalp
Copy link
Contributor

mrunalp commented Jul 29, 2016

LGTM

Approved with PullApprove

@mrunalp
Copy link
Contributor

mrunalp commented Jul 29, 2016

@cyphar @crosbymichael @hqhq PTAL

@cyphar
Copy link
Member

cyphar commented Jul 30, 2016

I'm wondering if we should use strings.TrimSuffix. This will replace the first occurrence of init.scope in the path, but we actually want to remove the last one -- right? Though you'd want to do a filepath.Clean first.

@sjenning
Copy link
Contributor Author

sjenning commented Aug 1, 2016

@cyphar I can do that. There should only ever be one occurrence of init.scope in the path but I can change it just to make it more self-documenting.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
@sjenning
Copy link
Contributor Author

sjenning commented Aug 1, 2016

@cyphar updated PTAL. Also I think Jenkins flaked, might need someone retry that.

@mrunalp
Copy link
Contributor

mrunalp commented Aug 1, 2016

I've kicked off the tests again.

@cyphar
Copy link
Member

cyphar commented Aug 1, 2016

LGTM.

Approved with PullApprove

@mrunalp
Copy link
Contributor

mrunalp commented Aug 1, 2016

LGTM

Approved with PullApprove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants