Skip to content

Low nproc ulimit causes compiler to crash #76452

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

Open
slymon99 opened this issue Sep 7, 2020 · 5 comments
Open

Low nproc ulimit causes compiler to crash #76452

slymon99 opened this issue Sep 7, 2020 · 5 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@slymon99
Copy link

slymon99 commented Sep 7, 2020

System

edit: I believe the core problem

-bash-4.2$ ulimit -u
100

CentOS Linux release 7.7.1908 (Core)

Code

fn main() {
    println!("Hello, world!");
}

Fresh project, failing to build with dependency mini-redis = "0.2.0"

edit: this happens on any medium sized project.

I've tried this fix from #69140 to no avail

[profile.dev]
codegen-units = 1

[profile.release]
codegen-units = 1

Meta

rustc --version --verbose:

-bash-4.2$ rustc --version --verbose
rustc 1.39.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 7.0

Error output

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5

Full error log (there's a lot of these errors https://pastebin.com/raw/j884m0Y9)

Backtrace

Caused by:
  Resource temporarily unavailable (os error 11)
warning: build failed, waiting for other jobs to finish...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
error: failed to run custom build command for `ryu v1.0.5`

Caused by:
  could not execute process `/home/simonc99/cs3700/mini_redis/target/debug/build/ryu-c5c767e5e3581cb1/build-script-build` (never executed)

Caused by:
  Resource temporarily unavailable (os error 11)
warning: build failed, waiting for other jobs to finish...
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::continue_panic_fmt
   8: rust_begin_unwind
   9: core::panicking::panic_fmt
  10: core::result::unwrap_failed
  11: rustc_interface::util::spawn_thread_pool
  12: rustc_driver::run_compiler
  13: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  14: std::panicking::try::do_call
  15: __rust_maybe_catch_panic
  16: rustc_driver::catch_fatal_errors
  17: rustc_driver::main
  18: std::rt::lang_start::{{closure}}
  19: std::panicking::try::do_call
  20: __rust_maybe_catch_panic
  21: std::rt::lang_start_internal
  22: main
  23: __libc_start_main
  24: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Full backtrace https://pastebin.com/raw/nAKJNY44

@slymon99 slymon99 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 7, 2020
@slymon99
Copy link
Author

slymon99 commented Sep 7, 2020

Solved. Problem was a low nproc ulimit (100). Either raising the limit or compiling with --j1 to remove parallelism both fix the issue.

I'll leave the issue for someone else to close - I'm not sure what ulimit rustc expects to support (in parallel) without panicking. If 100 is unsupported, feel free to close the issue.

@slymon99 slymon99 changed the title Failed to spawn thread, err: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" } CentOS linux Low nproc ulimit causes compiler to crash Sep 7, 2020
@Dylan-DPC-zz Dylan-DPC-zz added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 7, 2020
@Cerber-Ursi
Copy link
Contributor

I'm not sure what ulimit rustc expects to support (in parallel) without panicking.

AFAIK, it shouldn't panic, however low ulimit is. It should exit cleanly with some non-zero exit code and a helpful message. So the bug is in its place.

@spastorino
Copy link
Member

Assigning P-medium as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@spastorino spastorino added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 9, 2020
@workingjubilee
Copy link
Member

workingjubilee commented Sep 11, 2020

This bug was filed for 1.39. I can't reproduce with nightly and ulimit 100 on Arch Linux. (still errors, no ICE)

nm I just had to drop ulimit -u even lower. 🤷 Get "error during codegen phase."

@slymon99
Copy link
Author

This bug was filed for 1.39. I can't reproduce with nightly and ulimit 100 on Arch Linux. (still errors, no ICE)

nm I just had to drop ulimit -u even lower. 🤷 Get "error during codegen phase."

Yea I believe its related to the size of the project vs the number of threads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants