Skip to content

'failed to spawn thread' from OS is not handled early on and causes ICEs later. #81239

Closed
@egeyar

Description

@egeyar

Not easily reproducible.
Seems related to the issue #77894.

A colleague saw ICEs after spawning a thread failed. Maybe the compiler can exit gracefully at that point, rather than continuing and throwing ICEs later on.

The error logs state the version as:
note: rustc 1.45.2 running on x86_64-unknown-linux-gnu

The following is the logs we got:

building
   Compiling <our_sources> v0.1.0 (/build/source)
thread '<unnamed>' panicked at 'failed to spawn thread: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', /build/rustc-1.45.2-src/src/libstd/thread/mod.rs:619:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.2 running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=/nix/store/azayfhqyg9mjyv6rv9bcypi6ws8aqfmy-gcc-wrapper-9.3.0/bin/cc -C incremental -C rpath --crate-type lib

note: some of the compiler flags provided by cargo are hidden

thread 'rustc' panicked at 'src/librustc_codegen_ssa/back/write.rs:1701: panic during codegen/LLVM phase', src/librustc_middle/util/bug.rs:37:26

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.2 running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=/nix/store/azayfhqyg9mjyv6rv9bcypi6ws8aqfmy-gcc-wrapper-9.3.0/bin/cc -C incremental -C rpath --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: could not compile `<our_sources>`.

To learn more, run the command again with --verbose.
builder for '/nix/store/wnnqgm71yim8l4cz6bzxkqw79k4wil9b-<our_sources>-0.1.0.drv' failed with exit code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions