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

drivers: move executor process out of v1 task cgroup after process starts #24340

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Oct 31, 2024

This PR changes the behavior of the raw exec task driver on old cgroups v1
systems such that the executor process is no longer a member of the cgroups
created for the task. Now, the executor process is placed into those
cgroups and starts the task child process (just as before), but now then
exits those cgroups and exists in the nomad parent cgroup. This change
makes the behavior sort of similar to cgroups v2 systems, where we never
have the executor enter the task cgroup to begin with (because we can
directly clone(3) the task process into it).

Fixes #23951

…arts

This PR changes the behavior of the raw exec task driver on old cgroups v1
systems such that the executor process is no longer a member of the cgroups
created for the task. Now, the executor process is placed into those
cgroups and starts the task child process (just as before), but now then
exits those cgroups and exists in the nomad parent cgroup. This change
makes the behavior sort of similar to cgroups v2 systems, where we never
have the executor enter the task cgroup to begin with (because we can
directly clone(3) the task process into it).

Fixes #23951
@shoenig shoenig added this to the 1.9.x milestone Nov 5, 2024
@shoenig shoenig added backport/ent/1.9.x+ent Changes are backported to 1.9.x+ent backport/1.9.x backport to 1.9.x release line labels Nov 5, 2024
@shoenig shoenig marked this pull request as ready for review November 5, 2024 14:30
//
// its use case is for moving the executor process out of the task cgroup once
// the child task process has been started (cgroups v1 only)
type runningFunc func() error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you return this functions instead of making them methods of the executor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong reason, it's just that the implementions are different between cgroups v1 and v2. Seemed like defining them as closures inside already-version specific functions was a bit cleaner than expanding the number of functions defined on the executor.

Copy link
Member

@Juanadelacuesta Juanadelacuesta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a question just out of curiosity, other than that, nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.9.x+ent Changes are backported to 1.9.x+ent backport/1.9.x backport to 1.9.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rawexec: Allow only running task process in cgroup v1 overrides
2 participants