-
-
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
Too many open files on multi-user installation on Ubuntu #6007
Comments
Try adding |
I already said I tried changing
Systemd services appear to ignore limits other than those set by |
|
|
Adding |
I'm just running the build of our mobile application, which pulls a SHITLOAD of dependencies, especially for Gradle: So I'd guess that's why it fails for our builds, but I can try checking. |
There you go, 1024 file descriptors open: Most of it is a combination of Node.js dependencies pulled in by yarn2nix and Gradle dependencies pulled in by our own setup:
|
One thing worth noting is that Systemd services seem to ignore the |
I think This format appears to work fine:
Which appears to match the format of the defaults:
|
It appears Which was effective since |
Also, since what's causing the error is the soft limit Nix could raise it's own soft limit using the
I do see some references to use of But using it would probably involve some additional logic, like checking the limit against currently opened files and raising the limit only when necessary in steps or something like that. Just adding |
Are these building/downloading in parallel (i.e. |
Yes, it's downloading POMs and JARs. You can see that here: We use |
Hm, we acquire a path lock before obtaining a build slot, so if a derivation has a few thousand direct dependencies, Nix will lock acquire a few thousand locks, regardless of how many build slots there are... |
Depends, my VM? 4 cores. Our CI hosts? 12 cores. The same thing happens regardless. |
NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
I have tried setting |
Due to changes in how Nix handles Git refs we need to specify `refs/tags/` prefix in `package.json` to avoid the following error: ``` fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6 error: program 'git' failed with exit code 128 ``` I also had to rewrite some logic in `nix/scripts/source.sh` in order to take account of single-user and multi-user installations. We default to multi-user for Darwin, but not for any other OS due to discovered issues with `nix-daemon` socket on Arch and open file limits. Resolves: #12832 Depends on: status-im/status-jenkins-lib#37 Issues: * NixOS/nix#5291 * NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
Due to changes in how Nix handles Git refs we need to specify `refs/tags/` prefix in `package.json` to avoid the following error: ``` fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6 error: program 'git' failed with exit code 128 ``` I also had to rewrite some logic in `nix/scripts/source.sh` in order to take account of single-user and multi-user installations. We default to multi-user for Darwin, but not for any other OS due to discovered issues with `nix-daemon` socket on Arch and open file limits. Resolves: #12832 Depends on: status-im/status-jenkins-lib#37 Issues: * NixOS/nix#5291 * NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
Due to changes in how Nix handles Git refs we need to specify `refs/tags/` prefix in `package.json` to avoid the following error: ``` fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6 error: program 'git' failed with exit code 128 ``` I also had to rewrite some logic in `nix/scripts/source.sh` in order to take account of single-user and multi-user installations. We default to multi-user for Darwin, but not for any other OS due to discovered issues with `nix-daemon` socket on Arch and open file limits. Resolves: #12832 Depends on: status-im/status-jenkins-lib#37 Issues: * NixOS/nix#5291 * NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
Due to changes in how Nix handles Git refs we need to specify `refs/tags/` prefix in `package.json` to avoid the following error: ``` fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6 error: program 'git' failed with exit code 128 ``` I also had to rewrite some logic in `nix/scripts/source.sh` in order to take account of single-user and multi-user installations. We default to multi-user for Darwin, but not for any other OS due to discovered issues with `nix-daemon` socket on Arch and open file limits. Resolves: #12832 Depends on: status-im/status-jenkins-lib#37 Issues: * NixOS/nix#5291 * NixOS/nix#6007 Signed-off-by: Jakub Sokołowski <jakub@status.im>
Because of this issue I will not default to multi-user installation on Linux for our developers, but will use it on our CI host, since there I can easily apply the systemd service definition fix. Maybe it can be fixed for a future release. |
I also hit this bug when I try to install latex with doc (reported here NixOS/nixpkgs#171218):
|
Keep in mind that build failures/issues on linux that are caused by having the sandbox disabled are mostly ignored. |
What does that mean? |
If a package fails to build and the reason behind it is that the sandbox is disabled, it is most likely not going to be fixed. You need multi-user mode for the sandbox. |
How is the sandbox related to the default I don't really get why you are referring to the sandbox in this issue, as it doesn't appear to be realted. At least to me. |
|
That in no way explains how it's related to the sandbox. |
Correct me if I'm wrong, but I think that SuperSandro2000 just meant that if you choose the single-user installation instead of the multi-user installation, then your developer may not be able to report bugs as in this mode the sandbox is disabled, and that therefore it may be worth using the multi-user installation (and fix this bug?). To come back to this issue, on NixOs I was able to solve my problem using this, but I'm not sure if something similar could apply here as it does not even target NixOs.
|
Ooooh, okay, that actually makes sense. Thanks for explaining @tobiasBora. And yes, I agree, I'd prefer to stick to multi-user everywhere to avoid issues caused by inconsistent setups. But at the same time I'd rather keep the setup process as default as possible. And yes, the issue in question has been observed on Ubuntu and Arch, I've not experienced in on NixOS. |
This is not a complete fix: when running nix as root, the daemon is not used, so the low default fileno ulimit (1024) makes nix builds fail often. I think nix should use setrlimit itself to raise the soft limit. |
Is this supposed to be solved in NixOs as well? I just installed a fresh NixOs 23.11, and I’m running into that error again. I tried to check the value of |
I installed Nix yesterday on Ubuntu 24.04. I just bumped on this issue trying to install TexLive: I really don't understand the discussion above about sandboxes, I am just starting to use Nix. Please let me know if there is an obvious fix. |
Got this one on NixOS unstable-small today; ran nixos-rebuild twice, same error, then |
I just hit this on nixos-unstable $ nix --version
nix (Nix) 2.24.1 |
Just got it too. I'm on stable, with only a few packages using unstable, and nix 2.24.3. Rebuilding again fixed it. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-the-address-the-too-many-open-files-issue/51646/1 |
Likely fixed by #11408 (present in Nix 2.24.5+). According to that PR, it was present in 2.24.0+, hence the reoccurrence. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/update-fails-with-permission-denied/51663/1 |
@cole-h This issue prevails with release 2.25.
|
Note that that revision of 2.25pre is from before the bug fix was merged to master. Once my PR to fix the systemd unit is merged (#11413) you'll be able to update Nix to a revision that includes the fix. Or you can fetch the patch yourself. |
@cole-h Could you explain how to do that? |
You have two options:
Whichever you choose, the process will be the same: create an overlay for the final: prev: {
nix = prev.nix.overrideAttrs ({ patches ? [ ], ... }): {
patches = patches ++ [
(final.fetchpatch {
url = "the url to whichever PR's patch you chose";
hash = "sha256-.........";
})
];
};
} and import it after the Nix |
@cole-h I so far failed to follow your instructions. I guess my knowledge of Nix is not yet up to it. Since this is a lateral discussion, could you just point me to where I can learn what are things such as a package overlay and how to update to a Nix master (according to the forum I should now have the very latest installed). |
@edolstra Thank you for chiming in. Problem is: I don't really know how to do that. For the moment I can get the latest stable and the latest unstable, installing a precise release I haven't figured yet. |
At the advice of a friend I removed the Nix version I had installed from the official repositories and installed from zero-to-nix instead. That got me version 2.24.5, that indeed does not suffer from this bug. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-the-address-the-too-many-open-files-issue/51646/2 |
Describe the bug
I'm installing
2.5.1
(but I also tested2.6.0
) on Ubuntu, and I'm getting some varation of errors like these when building a big project:Steps To Reproduce
21.10
and20.04.3 LTS
2.5.1
or2.6.0
Too many open files
Expected behavior
I expected it to work out of the box, but I also expected that something like
ulimit -Sn 4096
or editing/etc/security/limits.conf
to fix the problem but it doesn't. Nor does settingfs.file-max
to something high in/etc/sysctl.conf
.What DOES fix the problem is adding:
In
/etc/systemd/system/nix-daemon.service
, but that's not a good solution, since it would require me to ask developers to perform these additional actions after installation. Wouldn't it make sense to include an increased open files limit in the service definition by default?Based on this post Systemd services appear to ignore system-wide limits - both hard and soft - and have to be adjusted in the service definition, or it defaults to
1024
for the soft limit:Additional context
I'm attempting to upgrade our mobile application build setup to
2.5.1
in status-im/status-mobile#12980.The text was updated successfully, but these errors were encountered: