-
Notifications
You must be signed in to change notification settings - Fork 2.2k
runc exec: use CLONE_INTO_CGROUP #4812
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
base: main
Are you sure you want to change the base?
Conversation
aa873c8
to
115aa1f
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
467d16c
to
dfcf22a
Compare
I notice that all the failures occurred in rootless container tests. This might be related to: runc/libcontainer/process_linux.go Line 205 in dfcf22a
However, you mentioned we're seeing an ENOENT error here, so that may not be the cause. |
dfcf22a
to
6095b61
Compare
@kolyshkin Wait, I thought we always communicated with systemd when using Is this just for our testing, or are users actually using this? Because we will need to fix that if we have users on systemd-based systems using cgroups directly without transient units... |
When you use I'm pretty sure it has been that way from the very beginning. One other thing is, when using systemd, we configure everything via systemd and then use fs/fs2 driver to write to cgroup directly. This is also how things have always been. One reason for that is we did not care much to translate OCI spec into systemd settings, which is now mostly fixed. Another reason is, systemd doesn't support all per-cgroup settings that the kernel has (so some of those can't be expressed as systemd unit properties). |
The thing is, while the comment says "EBUSY", the actual code doesn't check for particular error, going for this fallback on any error (including ENOENT). My guess is, with systemd driver we actually need |
6e3bf36
to
9489925
Compare
Apparently, we are also not placing rootless container exec's into the proper cgroup (which is still possible when using cgroup v2 systemd driver, but we'd need to use Tacking it in #4822 |
I'm aware of the mixed fs/systemd setup, my confusion was more that systemd very strictly expects to be told about stuff in cgroupv2 because cgroupv2 was designed around a global management process -- it has been a long time since I reviewed the first cgroupv2 patches for runc, but I remember that being a thing I was worried about at the time. The exec issue seems bad too... |
9489925
to
f96e179
Compare
b56a52b
to
1652210
Compare
Guess what, this is no longer happening. Based on cgroup name ( |
1652210
to
58ed84c
Compare
58ed84c
to
99977d2
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.
I'm unsure if retrying only when specific errors are returned is enough to not screw it up in older kernels.
Also, this will mean in old kernels we will always fail the first time calling clone. I guess it's fine?
99977d2
to
1b6d405
Compare
This is based on work done in [1]. Since the functionality requires a recent kernel and might not work, implement a fallback. [1]: https://go-review.googlesource.com/c/go/+/417695 Signed-off-by: Kir Kolyshkin <[email protected]>
1b6d405
to
d1d3712
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, thanks! One nit about a debug line, but worst case we can add it later.
// Rootless has no direct access to cgroup. | ||
return true | ||
} | ||
|
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.
I fear we might nor retry in a case we should and then the container will never start for the user and be a big regression. Can we log as debug what was the error before returning false?
So in case that happens, we can ask them to run with debug and check the error they get and we just handle that case?
Requires (and currently includes) PR #4822; draft until that one is merged.It makes sense to make runc exec benefit from
clone2(CLONE_INTO_CGROUP)
, whenavailable. Since it requires a recent kernel and might not work, implement a fallback.
Based on work done in
Closes: #4782.