Skip to content

runsc/container: ignore cgroup EBUSY errors in rootless mode #8112

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

Closed
wants to merge 1 commit into from

Conversation

prattmic
Copy link
Member

When runsc is running inside of an existing container, writing to /sys/fs/cgroup/cgroup.subtree_control fails with EBUSY because the cgroup is not empty.

It is likely a more general bug that we fail here, but in rootless mode cgroups aren't required anyways, so we can workaround the issue by simply ignoring it in rootless mode.

For #8111.

When runsc is running inside of an existing container,
writing to /sys/fs/cgroup/cgroup.subtree_control fails with EBUSY
because the cgroup is not empty.

It is likely a more general bug that we fail here, but in rootless mode
cgroups aren't required anyways, so we can workaround the issue by
simply ignoring it in rootless mode.

For google#8111.
@prattmic
Copy link
Member Author

I don't think this will have any impact there since they are getting EINVAL and this CL ignores only EBUSY. But it could be related to the same underlying issue? I'm not sure.

One major difference is that their issue is 'rare', while mine is 100% reproducible, because my cgroup.procs always has contents prior to runsc running.

@manninglucas
Copy link
Contributor

Looks like runc just ignores errors in this situation instead of erroring out like we for the reason you mentioned (could be rootless or containerized). I think a better solution here is to just imitate runc instead of adding a special case around Install(). I will follow up with a PR

copybara-service bot pushed a commit that referenced this pull request Oct 21, 2022
This matches how runc handles the case, since controllers may not be enabled
when rootless or containerized. If cgroup modifications are attempted they
will just fail in the setXXX() functions anyway.

Reference: https://github.com/opencontainers/runc/blob/main/libcontainer/cgroups/fs2/create.go#L146

Fixes #8112

PiperOrigin-RevId: 482912105
@avagin
Copy link
Collaborator

avagin commented Oct 24, 2022

What rootless mode do you mean? In case of --rootless, we ignore cgroup errors. If you are talking about true rootless containers, I don't think that we need to ignore cgroup errors. As for /sys/fs/cgroup/cgroup.subtree_control, we can read it to check that it has all required controlers.

@prattmic
Copy link
Member Author

I am referring to runsc --rootless run.

The context of this is inclusion of gVisor "integration" benchmarks in Go's benchmarking suite. I don't think we particularly care about whether these are "true rootless containers", we just don't want to need root to run benchmarks.

@avagin
Copy link
Collaborator

avagin commented Oct 28, 2022

@prattmic I think you can use the --ignore-cgroups in this case.

@github-actions
Copy link

A friendly reminder that this PR had no activity for 120 days.

@github-actions github-actions bot added the stale-pr This PR has not been updated in 120 days. label Sep 13, 2023
Copy link

This PR has been closed due to lack of activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-closed ready to pull stale-pr This PR has not been updated in 120 days.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants