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

Raw exec can use cgroups to manage PIDs #4350

Merged
merged 6 commits into from
Jun 1, 2018
Merged

Raw exec can use cgroups to manage PIDs #4350

merged 6 commits into from
Jun 1, 2018

Conversation

dadgar
Copy link
Contributor

@dadgar dadgar commented May 30, 2018

This PR makes it so that the raw exec driver uses cgroups to manage the
launched processes when on Linux and running as root. This can be disabled as
an option in the client map.

Fixes #4218 on Linux w/ cgroups and root

@@ -113,6 +113,11 @@ type ExecCommand struct {
// ResourceLimits determines whether resource limits are enforced by the
// executor.
ResourceLimits bool

// Cgroup marks whether we put the process in a cgroup. Setting this field
// doesn't enforce resource limits. To enforce limits, set ResoruceLimits.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo - ResourceLimits

if err := manager.Apply(pid); err != nil {
e.logger.Printf("[ERR] executor: error applying pid to cgroup subset %v: %v", e.resConCtx.cgPaths, err)
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole block looks super convoluted, is this the only way to do it though? not an expert here..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it is! I did my best to comment every operation since it is confusing. The API of the library we use for cgroups kinda forces this complexity. Couldn't figure out another way to do it!

@@ -261,6 +265,92 @@ func TestRawExecDriver_Start_Kill_Wait(t *testing.T) {
}
}

func TestRawExecDriver_Start_Kill_Wait_Cgroup(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

would add a comment that this test verifies that a raw exec task's process gets killed correctly when configured to use cgroup.

@dadgar dadgar force-pushed the b-raw-exec-cgroups branch from 448ac9c to f47b78e Compare May 31, 2018 18:10
@dadgar dadgar force-pushed the b-raw-exec-cgroups branch 2 times, most recently from faf8c9f to fe18315 Compare June 1, 2018 00:15
@dadgar dadgar force-pushed the b-raw-exec-cgroups branch from 7f7a24d to 103e867 Compare June 1, 2018 01:05
@dadgar dadgar force-pushed the b-raw-exec-cgroups branch from 103e867 to 657dd1e Compare June 1, 2018 17:15
@dadgar dadgar merged commit 462ad9d into master Jun 1, 2018
@dadgar dadgar deleted the b-raw-exec-cgroups branch June 1, 2018 17:37
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants