Skip to content

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Jan 14, 2026

Closes #16999

See the commentary at #16999 (comment) for precedence in other tools.

This is non-fatal on error, but there are various scary behaviors from increased ulimit sizes so I've gated this with preview.

@zaniebot zaniebot force-pushed the claude/add-ulimit-adjustment-pbq7y branch 3 times, most recently from 035a889 to 023a554 Compare January 14, 2026 15:38
@zaniebot zaniebot force-pushed the claude/add-ulimit-adjustment-pbq7y branch 2 times, most recently from d3904a9 to 056f8cf Compare January 14, 2026 15:46
@zanieb zanieb force-pushed the claude/add-ulimit-adjustment-pbq7y branch 2 times, most recently from 661f085 to 185c3dd Compare January 14, 2026 20:26
Linux defaults to a low open file limit (1024) and macOS also defaults to
a low soft limit (256). On modern multi-core machines, uv may schedule more
concurrent work than these limits allow, causing "too many open files" errors.

This adds a new `uv-unix` crate that raises the soft limit to the hard limit
at startup. The raised limit is inherited by child processes spawned via
`uv run`.

See: astral-sh#16999
@zanieb zanieb added the preview Experimental behavior label Jan 14, 2026
claude and others added 4 commits January 14, 2026 15:25
The ulimit adjustment is now gated behind the `adjust-ulimit` preview
feature, which can be enabled via `--preview` or
`--preview-features=adjust-ulimit`.
This matches the typical Linux default (`/proc/sys/fs/nr_open`) and avoids
issues with extremely high limits that can break code expecting i32 values
or cause timeouts when iterating over all possible FDs.

OpenJDK uses the same cap for similar reasons.

See: https://bugs.openjdk.org/browse/JDK-8324577
See: oracle/graal#11136
Use `rlim_t` instead of `u64` for the `MAX_NOFILE_LIMIT` constant
since `rlim_t` is platform-specific (`u64` on Linux/macOS, `i64`
on FreeBSD).

Add a `rlim_t_to_u64` helper for safe conversion that returns `None`
for negative values (defensive, since resource limits should never
be negative in practice).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zanieb zanieb force-pushed the claude/add-ulimit-adjustment-pbq7y branch from 185c3dd to f0b5397 Compare January 14, 2026 21:26
@zanieb zanieb marked this pull request as ready for review January 15, 2026 05:41
Copy link
Member

@zsol zsol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +21 to +32
/// We cap at 0x100000 (1,048,576) to match the typical Linux default (`/proc/sys/fs/nr_open`)
/// and to avoid issues with extremely high limits.
///
/// `OpenJDK` uses this same cap because:
///
/// 1. Some code breaks if `RLIMIT_NOFILE` exceeds `i32::MAX` (despite the type being `u64`)
/// 2. Code that iterates over all possible FDs, e.g., to close them, can timeout
///
/// See: <https://bugs.openjdk.org/browse/JDK-8324577>
/// See: <https://github.com/oracle/graal/issues/11136>
///
/// Note: `rlim_t` is platform-specific (`u64` on Linux/macOS, `i64` on FreeBSD).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 for the extensive comment

@zanieb zanieb force-pushed the claude/add-ulimit-adjustment-pbq7y branch from e3b4a6f to 803cb3c Compare January 15, 2026 17:27
@zanieb zanieb enabled auto-merge (squash) January 15, 2026 17:28
@zanieb zanieb merged commit d673867 into astral-sh:main Jan 15, 2026
143 of 180 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jan 17, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.24` → `0.9.26` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.26`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0926)

[Compare Source](astral-sh/uv@0.9.25...0.9.26)

Released on 2026-01-15.

##### Python

- Add CPython 3.15.0a5

##### Enhancements

- Add a hint to update uv when a managed Python download is not found ([#&#8203;17461](astral-sh/uv#17461))
- Improve cache initialization failure error message ([#&#8203;17469](astral-sh/uv#17469))
- Improve error message for abi3 wheels on free-threaded Python ([#&#8203;17442](astral-sh/uv#17442))
- Add support for `--no-sources-package` ([#&#8203;14910](astral-sh/uv#14910))

##### Preview features

- Add `METADATA.json` and `WHEEL.json` in uv build backend ([#&#8203;15510](astral-sh/uv#15510))
- Add support for GCS request signing ([#&#8203;17474](astral-sh/uv#17474))
- Adjust the process ulimit to the maximum allowed on startup ([#&#8203;17464](astral-sh/uv#17464))

##### Bug fixes

- Lock to avoid concurrent refresh of pyx tokens ([#&#8203;17479](astral-sh/uv#17479))

##### Documentation

- Add linting and formatting instructions to the CONTRIBUTING guide ([#&#8203;17470](astral-sh/uv#17470))
- Avoid rendering `pyproject.toml` examples for more system-level settings ([#&#8203;17462](astral-sh/uv#17462))

### [`v0.9.25`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0925)

[Compare Source](astral-sh/uv@0.9.24...0.9.25)

Released on 2026-01-13.

##### Python

- Add CPython 3.15.0a4
- Upgrade Tcl/Tk used by CPython to 9.0

##### Enhancements

- Add `--compile-bytecode` to `uv python install` and `uv python upgrade` to compile the standard library ([#&#8203;17088](astral-sh/uv#17088))
- Allow disabling `exclude-newer` per package ([#&#8203;16854](astral-sh/uv#16854))
- Broadcast `WM_SETTINGCHANGE` on `uv tool update-shell` ([#&#8203;17404](astral-sh/uv#17404))

##### Preview features

- Detect workspace from `uv run` target ([#&#8203;17423](astral-sh/uv#17423))

##### Bug fixes

- Avoid unwrapping size for file responses ([#&#8203;17434](astral-sh/uv#17434))
- Use keyring authentication when retrieving `tool@latest` version ([#&#8203;17448](astral-sh/uv#17448))
- Use latest Pyodide version for each python version ([#&#8203;17372](astral-sh/uv#17372))
- Improve trampoline file handle closing ([#&#8203;17374](astral-sh/uv#17374))
- Fix error message when installing musl python on armv7 ([#&#8203;17213](astral-sh/uv#17213))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44MC4xIiwidXBkYXRlZEluVmVyIjoiNDIuODEuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bytecode compilation can fail with "too many open files" on default Ubuntu settings

4 participants