-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Pids-limit should only be set if the user set it #6842
Conversation
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
I don't like this because it disables the default PID limit entirely, even for root containers. We should preserve the default limit where possible (root and cgroups v2 rootless) |
@mheon The default limit should be handled on the server side, if the user does not specify a root limit then pkg/specgen should use the default. |
I don't see code for that anywhere. |
@mheon Added the defaults. |
@@ -169,6 +170,19 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat | |||
} | |||
} | |||
|
|||
// If caller did not specify Pids Limits load default | |||
if s.ResourceLimits.Pids == nil { | |||
if s.CgroupsMode != "disabled" { |
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.
We also need to make sure we are not rootless + cgroups v1
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.
The rtc.PidsLimit() takes care of this.
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.
rtc.PidsLimit() is returning 4096 on my cgroups v1 machine, rootless, even though the default does not show in run --help.
pkg/specgen/generate/container.go
Outdated
@@ -169,6 +170,19 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat | |||
} | |||
} | |||
|
|||
// If caller did not specify Pids Limits load default | |||
if s.ResourceLimits.Pids == nil { |
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.
This could null-pointer, I think - s.ResourceLimits
may be null.
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.
Fixed
pkg/specgen/generate/container.go
Outdated
@@ -169,6 +170,19 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat | |||
} | |||
} | |||
|
|||
// If caller did not specify Pids Limits load default | |||
if s.ResourceLimits != nil && s.ResourceLimits.Pids == nil { |
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.
Do we want to make ResourceLimits if it was null and Pids is not empty?
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 think this will be the case for rootless v2, for example)
dba4cad
to
9b4e26a
Compare
Does not work.
|
Confirmed here as well. |
Ah, I think I know what's going on here. The code in containers/common for determining default limit is broken.
Notice that if cgroup manager is set to cgroupfs, we will drop through the conditionals and return |
if it's cgroupfs, we return 0 - that's what I see |
NVM you're right. |
The return 0 needs to move out one level probably. |
Confirmed this fixes it:
|
Though I'm not sure why cgroups v2 can't set a pids limit in cgroupfs mode - if the pids controller is in our cgroup, and we have write access to it, why can't we? |
7e42ddc
to
4828943
Compare
This merges a bunch of vendor dependencies which breaks the build. Could you remove the runc bump from 1.0.0-rc90 to rc91? It breaks things in buildah due to changes in libcontainer... IMHO that bump should be a separate PR, allowing for fixes to that issue to be tracked under their own issue/PR. I've verified removing the runc bump fixes the compile. |
@rhatdan https://github.com/goochjj/libpod/tree/rhatdan-pids-limit Rebased, with runc rc90 and common 0.15.2 |
My branch updated and ready if #6897 is merged. |
a7b2fbe
to
1c2cdf2
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Currently we are sending over pids-limits from the user even if they never modified the defaults. The pids limit should be set at the server side unless modified by the user. This issue has led to failures on systems that were running with cgroups V1. Signed-off-by: Daniel J Walsh <[email protected]>
I'm going to give this a final test on Debian to verify it fixes v1, but LGTM based on what I see now. |
Confirmed working on Debian with v1 |
Currently we are sending over pids-limits from the user even if they
never modified the defaults. The pids limit should be set at the server
side unless modified by the user.
This issue has led to failures on systems that were running with cgroups V1.
Signed-off-by: Daniel J Walsh [email protected]