Skip to content

Add io::ErrorKind::TooManyOpenFiles#158326

Open
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:io-error-too-many-open-files
Open

Add io::ErrorKind::TooManyOpenFiles#158326
valentynkit wants to merge 1 commit into
rust-lang:mainfrom
valentynkit:io-error-too-many-open-files

Conversation

@valentynkit

@valentynkit valentynkit commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Adds an unstable io::ErrorKind::TooManyOpenFiles for the open-file-limit condition.

EMFILE and ENFILE currently decode to ErrorKind::Uncategorized, so stable code cannot tell that an operation failed because the process or the system ran out of file descriptors without inspecting raw_os_error() and a platform-specific libc/windows-sys constant.

Implements the accepted ACP rust-lang/libs-team#818, including its decision to collapse EMFILE and ENFILE into a single variant. Finer-grained handling stays available through raw_os_error().

The variant maps:

  • EMFILE / ENFILE on Unix and WASI
  • ERROR_TOO_MANY_OPEN_FILES / WSAEMFILE on Windows
  • FR_TOO_MANY_OPEN_FILES on VEXos

Tracking issue: #158319

r? libs

`EMFILE` and `ENFILE` decoded to `ErrorKind::Uncategorized`, so running
out of file descriptors could only be detected through `raw_os_error()`.
Map them, and the equivalent codes on Windows (`ERROR_TOO_MANY_OPEN_FILES`,
`WSAEMFILE`) and VEXos (`FR_TOO_MANY_OPEN_FILES`), to a new unstable
`TooManyOpenFiles` variant.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 23, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  IMAGE: x86_64-gnu-tools
##[endgroup]
    Updating crates.io index
error: failed to get `adler2` as a dependency of package `miniz_oxide v0.8.8`
    ... which satisfies dependency `miniz_oxide = "^0.8.5"` of package `flate2 v1.1.9`
    ... which satisfies dependency `flate2 = "^1.1.9"` of package `citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)`

Caused by:
  failed to load source for dependency `adler2`

Caused by:
  unable to update registry `crates-io`

Caused by:
  download of ad/le/adler2 failed

Caused by:
  curl failed

Caused by:

@jhpratt

jhpratt commented Jun 24, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

PR CI failure is spurious

@rust-bors

rust-bors Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9261852 has been approved by jhpratt

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 5. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 24, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 24, 2026
…-files, r=jhpratt

Add `io::ErrorKind::TooManyOpenFiles`

Adds an unstable `io::ErrorKind::TooManyOpenFiles` for the open-file-limit condition.

`EMFILE` and `ENFILE` currently decode to `ErrorKind::Uncategorized`, so stable code cannot tell that an operation failed because the process or the system ran out of file descriptors without inspecting `raw_os_error()` and a platform-specific `libc`/`windows-sys` constant.

Implements the accepted ACP rust-lang/libs-team#818, including its decision to collapse `EMFILE` and `ENFILE` into a single variant. Finer-grained handling stays available through `raw_os_error()`.

The variant maps:
- `EMFILE` / `ENFILE` on Unix and WASI
- `ERROR_TOO_MANY_OPEN_FILES` / `WSAEMFILE` on Windows
- `FR_TOO_MANY_OPEN_FILES` on VEXos

Tracking issue: rust-lang#158319

r? libs
rust-bors Bot pushed a commit that referenced this pull request Jun 24, 2026
Rollup of 35 pull requests

Successful merges:

 - #158315 (`rust-analyzer` subtree update)
 - #158336 (Stop excluding `stdarch` test crates from `rust-src`)
 - #155739 (Add temporary scope to assert_eq and assert_ne)
 - #156885 (Fix misattributed type inference error span for index expressions)
 - #157271 (simplify some `proc_macro` things)
 - #157419 (move rustc_type_ir Term things to term_kind.rs)
 - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit)
 - #157921 (trait solver: Resolve region vars in max universe)
 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158053 (Optimize network address parser)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158279 (Follow goto and drop when linting unreachable code)
 - #157527 (Move derive tests into their dedicated folder)
 - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`)
 - #157939 (Reorganize `tests/ui/issues` [8/N])
 - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public)
 - #158003 (Reorganize `tests/ui/issues` [9/N])
 - #158020 (Update mingw-w64 C toolchain)
 - #158039 (c-variadic: test that we use equality up to free lifetimes)
 - #158060 (Reorganize `tests/ui/issues` [10/N])
 - #158222 (format: ignore println newline in foreign format hints)
 - #158223 (Move target checking for #[lang] to the attribute parser)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158263 (Only load the feature list once in the entire resolver)
 - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use)
 - #158272 (Reorganize `tests/ui/issues` [13/N])
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)
 - #158300 (Improve unknown crate_type diagnostic suggestions)
 - #158304 (mailmap: update mu001999)
 - #158309 (Update `rustc-literal-escaper` version to `0.0.8`)
 - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact)
 - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants