-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Revert commit that changed LimitNOFILE to infinity to avoid regressions #7566
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -32,7 +32,7 @@ RestartSec=5 | |||
# in the kernel. We recommend using cgroups to do container-local accounting. | ||||
LimitNPROC=infinity | ||||
LimitCORE=infinity | ||||
LimitNOFILE=infinity | ||||
LimitNOFILE=1048576 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
For the equivalent Equivalent change should hopefully follow soon here 🙏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for being so slow. I see in the meantime you created a separate PR already (#8924). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, I know how it is :) Thanks for kickstarting the process with the original attempt here! ❤️ |
||||
# Comment TasksMax if your systemd version does not supports it. | ||||
# Only systemd 226 and above support this version. | ||||
TasksMax=infinity | ||||
|
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.
Based on looking into the topic extensively, the following is:
docker.service
andcontainerd.service
to function (once they implicitly raise their soft limit to the hard limit as Go 1.19+ does)Additional info
fs.nr_open
(leaving it at default1048576
, this is the value thatinfinity
resolves to).LimitNOFILE
could technically be dropped. It is only relevant to builds before Go 1.19 because AFAIK there is nothing internal explicitly raising the soft limit, so the setting was used to ensure it was sufficient enough forcontainerd
to do it's thing (not containers themselves that inherit the limits).containerd
technically only needs262144
(2^18
) to support 65k (2^16
) busybox containers, which in itself needs over 200GiB of memory. I have shared my investigation + reproduction to back that up.2^16
which mitigates the issues and appears to be serving them well. That should still be capable of supporting thousands of containers on systems with memory of 64GB or higher.1024
would be ideal and reflect running software on a host outside of a container, and should not cause any regressions with builds using Go 1.19+.Uh oh!
There was an error while loading. Please reload this page.
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.
@polarathene thanks for this suggestion, I tried to set the
LimitNOFILE=1024:524288
for both thedocker.service
andcontainerd.service
usingoverride.conf
files in /etc/systemd/system/docker.service.d and /etc/systemd/system/containerd.service.d and noticed that both the hard limit and soft limit fornofile
(within my container) were set to524288
. I wonder if the soft limit fromLimitNOFILE
is ignored?I know the
override.conf
files are "dropped-in":Output from within the container:
Output on host:
Here is my output of
docker version
:If I add the following to my /etc/docker/daemon.json the ulimit hard and soft values for
nofile
are correct: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.
@dambrosio @polarathene it's a Golang issue, and will be fixed in the next patch release (the Go maintainers acknowledged a change they made in Go 1.19 was a regression, and a fix will be included in the next patch release); see the discussion on this ticket, and the related backport tickets;
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.
@thaJeztah I am well aware and was involved in the discussions to get the issue addressed 😎
@dambrosio my messages are a bit verbose sorry, but I did point this out in my review comment above:
Once that is available, both
dockerd.service
andcontainerd.service
should adjustLimitNOFILE
as suggested, and the soft limit will be respected for containers (without being an issue for either daemons needs as since Go 1.19).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.
DOH! I got lost in all the linked issues, and replied from my phone, yes ... I knew you knew...
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 suggestion seems completely reasonable assuming the syntax works even on older versions of systemd. I think centos7 is v219?
Uh oh!
There was an error while loading. Please reload this page.
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.
If previous values of
1048576
andinfinity
have worked fine prior to systemd v240, then yesLimitNOFILE
should be fine applying the soft/hard limit suggested here.As long as the releases are built with Go 1.19+ (otherwise the daemons would restrained to running approx 150 containers).
Uh oh!
There was an error while loading. Please reload this page.
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.
Go updated with fix
RLIMIT_NOFILE
syscall fix: runtime: automatically bump RLIMIT_NOFILE on Unix [1.19 backport] golang/go#59063contrainerd.service
anddocker.service
can now update their configs to move away fromLimitNOFILE=infinity
🎉Could the
LimitNOFILE=1024:524288
change request be applied, and queue this PR for review / merge? 😀EDIT: I've created the equivalent PR for
moby
(docker.service
and friends): moby/moby#45534Let me know if you'd like a similar PR for
containerd
(avoids the noise present here, and the original author has not applied the suggested feedback).Confirmation
Test values:
containerd.service
:LimitNOFILE=2048:8192
docker.service
:LimitNOFILE=3072:4096
This was tested on a Vultr VPS instance with Ubuntu 23.04 and installing Docker via the docs:
docker-ce 23.0.6
containerd containerd.io 1.6.21 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version: v1.1.7-0-g860f061
docker info