Skip to content
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

rustc fails to raise rlimits for stacksize on mac for doctest runs through make #52801

Closed
mitsuhiko opened this issue Jul 28, 2018 · 4 comments
Closed
Labels
P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mitsuhiko
Copy link
Contributor

mitsuhiko commented Jul 28, 2018

I get rlimit errors when running cargo test on a mac through make:

ERROR 2018-07-28T07:03:41Z: rustc_driver: in_rustc_thread: error calling setrlimit: Invalid argument (os error 22)

If run without make it works. Seems to be this call that is failing:

if libc::setrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 {
let err = io::Error::last_os_error();
error!("in_rustc_thread: error calling setrlimit: {}", err);
std::rt::update_stack_guard();
true
} else {

$ ulimit -s
8192

Repro case is just an empty library with a single doctest:

/// ```rust
/// assert!(1 == 1);
/// ```
pub fn foo() {
}

And then this makefile:

test:
	cargo test

Test runs:

mitsuhiko at argus in /tmp/x on git:master? rust 1.27.2
$ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running target/debug/deps/x-b63d1d867374a2db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests x

running 1 test
test src/lib.rs - foo (line 1) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out


mitsuhiko at argus in /tmp/x on git:master? rust 1.27.2
$ make test
cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running target/debug/deps/x-b63d1d867374a2db

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests x

running 1 test
ERROR 2018-07-28T07:10:59Z: rustc_driver: in_rustc_thread: error calling setrlimit: Invalid argument (os error 22)
test src/lib.rs - foo (line 1) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Versions:

$ (cargo --version; rustc --version; uname -a)
cargo 1.27.0 (1e95190e5 2018-05-27)
rustc 1.27.2 (58cc626de 2018-07-18)
Darwin argus.local 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul  6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64
@mitsuhiko
Copy link
Contributor Author

It seems that make has a higher ulimit for the stack for some reason:

mitsuhiko at argus in /tmp
$ cat foo.make
print-limits:
	ulimit -s

mitsuhiko at argus in /tmp
$ ulimit -s; make -f foo.make
8192
ulimit -s
65532

@nagisa nagisa added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 28, 2018
@nagisa
Copy link
Member

nagisa commented Jul 28, 2018

Seems to be another regression similar to #52577.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Aug 9, 2018

Is the failure perhaps because make has already raised the ulimit higher, so our attempts to "raise it" are actually trying to decrease it? Should we just check the current value before invoking setrlimit?

@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-medium Medium priority labels Aug 9, 2018
@nikomatsakis
Copy link
Contributor

Compiler-team meeting: Marking as P-medium for now.

kennytm added a commit to kennytm/rust that referenced this issue Aug 11, 2018
Make sure rlimit is only ever increased

`libc::setrlimit` will fail if we try to set the rlimit to a value lower than it is currently, so make sure we're never trying to do this. Fixes rust-lang#52801.
kennytm added a commit to kennytm/rust that referenced this issue Aug 13, 2018
Make sure rlimit is only ever increased

`libc::setrlimit` will fail if we try to set the rlimit to a value lower than it is currently, so make sure we're never trying to do this. Fixes rust-lang#52801.
kennytm added a commit to kennytm/rust that referenced this issue Aug 14, 2018
Make sure rlimit is only ever increased

`libc::setrlimit` will fail if we try to set the rlimit to a value lower than it is currently, so make sure we're never trying to do this. Fixes rust-lang#52801.
bors bot added a commit to gfx-rs/gfx that referenced this issue Sep 5, 2018
2379: fix metal build r=grovesNL a=stuartcarnie

Fixes metal compilation issue:

    metallib: Invalid bitcode file!


PR checklist:
- [ ] `make` succeeds (on *nix)
    - a few failures due to rust-lang/rust#52801
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: **metal**
- [x] `rustfmt` run on changed code

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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

3 participants