Repository navigation
Conversation
zanieb
reviewed
Aug 3, 2026
Comment on lines
+1324
to
+1326
| let Some(limit) = std::env::var_os(EnvVars::UV_RUN_ULIMIT) else { | ||
| return Ok(()); | ||
| }; |
Member
There was a problem hiding this comment.
We should thread this through instead.
zanieb
reviewed
Aug 3, 2026
Comment on lines
+1328
to
+1337
| let limit = limit.to_str().ok_or_else(|| { | ||
| anyhow!( | ||
| "Invalid value for `{}`: expected a non-negative integer", | ||
| EnvVars::UV_RUN_ULIMIT | ||
| ) | ||
| })?; | ||
| let soft = limit | ||
| .parse::<u32>() | ||
| .with_context(|| format!("Invalid value for `{}`: `{limit}`", EnvVars::UV_RUN_ULIMIT))?; | ||
| let soft = rlim_t::from(soft); |
Member
There was a problem hiding this comment.
This should be parsed in our environment options handling
zanieb
reviewed
Aug 3, 2026
Comment on lines
+1339
to
+1349
| let (_, hard) = | ||
| getrlimit(Resource::RLIMIT_NOFILE).context("Failed to read the open-file limit")?; | ||
| if hard != RLIM_INFINITY && soft > hard { | ||
| bail!( | ||
| "`{}` value `{soft}` exceeds the hard open-file limit `{hard}`", | ||
| EnvVars::UV_RUN_ULIMIT | ||
| ); | ||
| } | ||
|
|
||
| setrlimit(Resource::RLIMIT_NOFILE, soft, hard) | ||
| .with_context(|| format!("Failed to set the open-file limit to `{soft}`"))?; |
Member
There was a problem hiding this comment.
Can we share utility for doing this update?
zanieb
marked this pull request as ready for review
August 3, 2026 19:14
|
Promoted to #20926. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uv runraises the inherited open-file descriptor limit before launching its command, which can make programs such astcshspend substantial time closing every possible descriptor (astral-sh#20923).Add
UV_RUN_ULIMITto set a command-specific soft open-file limit after uv finishes preparing the environment and immediately before the command is spawned. Preserve the hard limit and reject invalid values or values above it.