-
Notifications
You must be signed in to change notification settings - Fork 315
Raise file descriptor limits on Unix #928
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
Conversation
|
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. (Because this pull request was imported automatically, there will not be any future comments.) |
| memoffset = "0.6.4" | ||
| multimap = "0.8.2" | ||
| nix = "0.22" | ||
| nix = { version = "0.26", features = ["fs", "resource", "signal"] } |
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.
Needed to bump this for access to nix::sys::resource (added in 0.23) and resource::RLIM_INFINITY (added in 0.26).
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 updated this to match what we use internally, you should be able to drop it if you rebase on master
Closes facebook#419 Fixes this error, very common on macOS where the default file descriptor soft limit is 1024: Internal error (stage: calculate_output_values_failed): collecting output ProjectRelativePathBuf("buck-out/v2/gen/root/aaaaaaaaaaaaaaaa/puppy/__puppy__/doggy"): Too many open files (os error 24)
|
Ugh, sorry, I realize I kind of reviewed this in the wrong order. This won't work as written, I think - the problem is that not all subprocesses buck2 spawns go through the forkserver (like, for example, the forkserver itself) and so that's going to get this all confused. Concretely, what I expect will happen is that you run this in the client, where you increase the soft limit and then set the static, but then the client starts the daemon without going through the forkserver, and so the daemon won't know that the client changed the default value and so won't know to revert it. Though actually, the daemon knowing to revert it wouldn't help, because it'll spawn the forkserver, and the forkserver is where you have to actually set this static to get it right. The thing I think you should do is this:
That should correctly target the actual processes you want |
|
Thanks, I was curious about that. I'll see about updating the |
|
I'm not entirely sure what the implementation strategy you're suggesting is. Here's my understanding, could you help me fill in the gaps? (Sorry this comment is a bit long.)
Does this mean "the daemon doesn't need to adjust the limits" or "the daemon needs to pass the limits to the forkserver"?
Interpretation: Don't set the static in
I think this means I should set the static / adjust the limits in
I'm not sure how to get the data from Notes for meThe forkserver CLI args are defined in CLI in general is defined in Here's the call path between the two functions you pointed at:
|
|
See the comments in #986 before anything else :)
If you set the static with the information about what the limits should be reset to in the daemon, then that doesn't solve your problem, because the forkserver will read a different "instance" of that static (so, more or less the second)
Correct
Yeah, maybe. I guess I probably would have put it into a different type that gets passed to some of the same places as
Mmm, this is backwards I think.
The command in question is the one here - you have access to a
I would guess that you probably do not need to touch this - if you look at what this is actually used for, it's not used for any arbitrary user controlled stuff, and so just inheriting the higher limits on those processes seems fine |
|
@JakobDegen merged this pull request in 053f772. |
Closes #419
Fixes this error, very common on macOS where the default file descriptor soft limit is 1024:
I expect this will still need some work, let me know if there's a better place to put these functions.