-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Set LimitNOFILE=1048576 in containerd unit file to match upstream containerd. #760
Set LimitNOFILE=1048576 in containerd unit file to match upstream containerd. #760
Conversation
…tainerd. The Ubuntu containerd package sets LimitNOFILE=infinity, but this causes issues with various applications: NFS and mysql are unable to run in kind on some systems. This fixes the containerd limit to match upstream containerd and resolves issues with NFS and mysql.
Welcome @jbarrick-mesosphere! |
Hi @jbarrick-mesosphere. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I finally found the setting on the host that causes this:
I think the root cause of this is:
It seems related to this issue (also where I found the fix): systemd/systemd#11510 I do still think the best thing to do is set LimitNOFILE in our containerd.service, but in the meantime it can be worked around at the host level by setting |
Thanks for the detailed description, just a few comments because I don´t have clear the relation between the file descriptors limit and the problems you are referencing. |
The applications seem to do big allocations up front of memory based on the amount of file descriptors they have available. For example, NFS gets the number of file descriptors using this method: And then does an allocation based on that:
In this case, that allocation would be 1073741816 * (sizeof int) (4?) bytes == 4.5 gigabytes. |
And also you are correct that this is fixed if I try mariadb, but doesn't look like the fix made it into mysql. But seems like that is a similar issue of a large up front allocation: systemd/systemd#11510 (comment) |
I´m not arguing against that, but I can´t see evidence that´s happening in your NFS example, have you double-checked with |
My point is that is an application problem allocating memory based on the number of file descriptor or not having the correct sanity checks to do it, I´m not in favor of workaround that in kind :) |
Please, don´t misunderstand me, I just want to fully understand this, so we can understand the consequences, we don´t know if there are kind users that need to go beyond the Seems that this setting on Arch Linux systems, where DefaultLimitNOFILE=infinity Also, I was checking at the containerd issue you mentioned, and the rationale to include a limit upstream was just the opposite, increasing the limit.
|
on Ubuntu 17.10 for me for systemd:
but if an application is making the assumption that it can in terms of capping the containerd service in kind, i guess it's OK, if |
Matching the upstream unit makes sense to me, I assume the Ubuntu package just doesn't have this change yet as their release train takes a bit. For precedence: the other override we apply is also a patch I sent to the upstream unit that hasn't landed in the package we have installed yet. /ok-to-test |
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.
Thanks for the PR!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, jbarrick-mesosphere 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 |
(I would also agree that these seem like bugs but, this decision to change the limit was already made upstream anyhow and seems reasonable to me) |
/retest Well, it seems this is only happening in arch Linux that's the only distro with no limit in systemd. |
By the way thanks @jbarrick-mesosphere for your patience and your explanations 😄 |
Thanks everyone 👍 |
the same issue, ulimit -n is 1073741816 , mount nfs , it happen: |
The Ubuntu containerd package sets LimitNOFILE=infinity, but this causes issues with various applications: NFS and mysql are unable to run in kind on some systems.
This fixes the containerd limit to match upstream containerd and resolves issues with NFS and mysql.
To reproduce the issue, on the host set
sudo sysctl -w fs.nr_open=1073741816
(this is the default on Arch Linux) and then follow the steps below.Broken:
Broken output:
Fixed:
Fixed output:
We can see upstream's unit file here: https://github.com/containerd/containerd/blob/d57cf6f151e444d125407526bf58bb8e79c5e47a/containerd.service#L17 and the background for why it was set there is here containerd/containerd#3201.
I believe this also fixes the issue referenced in #118 (comment) when rimusz said NFS does not work in kind.