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

Compiling Rust projects in a bind mount causes a "Too many open files" error #206

Open
campbellcole opened this issue Aug 27, 2024 · 3 comments

Comments

@campbellcole
Copy link

When I try to compile a reasonably large Rust project from within a bind-mounted persistence location, cargo fails with "Too many open files" so reliably that it's become nearly impossible to successfully compile any of my projects. I've found this is dramatically worse when using the mold linker, but still occurs regularly with the default linker.

In the best cases, I can compile the code by continuously restarting the build and relying on incremental compiles to slowly inch it along, and in most cases (namely tests), the build will never succeed no matter how many times I restart it.

I've tried increasing ulimit -n to a ridiculously large number (1073741816), and this still happens. From what I've read, increasing this limit to a number this large is far from a solution so I'd like to figure out the root cause of this but I'm at a loss. My guess is something cargo/rustc is doing is leaking FDs in the fuse FS.

Any advice would be greatly appreciated. I understand this may not be an issue with impermanence but I'm asking here to at least get an idea of where to look next.

@wvffle
Copy link

wvffle commented Sep 1, 2024

Related issue in the cargo repository with straces: rust-lang/cargo#14437

@campbellcole
Copy link
Author

I commented this in that thread, but I was able to fix this by moving all of my home folder mounts to the system config with environment.persistence."path".users.myuser. This makes impermanence use bind-mounts instead of bindfs which is also dramatically more performant.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/too-many-open-files-when-the-gradle-cache-is-persisted-via-impermanence/51560/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants