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

Regression in time to compilation failure #37571

Closed
jrobsonchase opened this issue Nov 3, 2016 · 4 comments · Fixed by #38984
Closed

Regression in time to compilation failure #37571

jrobsonchase opened this issue Nov 3, 2016 · 4 comments · Fixed by #38984

Comments

@jrobsonchase
Copy link

There seems to have been a regression a couple of weeks ago in the time it takes rustc to exit after reporting an error. Using the nightly from 2016-10-21, build failures exit in under half a second, but on the nightlies after that (starting on 2016-10-25), they hang for ~20 seconds.

jchase@tethys test_regression $ rustup default nightly-2016-10-21 && time rustc src/lib.rs; echo -e '\n\n'; rustup default nightly && time rustc src/lib.rs
info: using existing install for 'nightly-2016-10-21-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2016-10-21-x86_64-unknown-linux-gnu'

  nightly-2016-10-21-x86_64-unknown-linux-gnu unchanged - rustc 1.14.0-nightly (f09420685 2016-10-20)

error: expected one of `!` or `::`, found `#`
 --> src/lib.rs:2:1
  |
2 | #[cfg(test)]
  | ^

error: aborting due to previous error


real	0m0.237s
user	0m0.220s
sys	0m0.013s



info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.14.0-nightly (5665bdf3e 2016-11-02)

error: expected one of `!` or `::`, found `#`
 --> src/lib.rs:2:1
  |
2 | #[cfg(test)]
  | ^

error: aborting due to previous error


real	0m22.905s
user	0m22.827s
sys	0m0.070s

jchase@tethys test_regression $ cat src/lib.rs 
asdf
#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}

Fixing the error (asdf -> fn main() {}) results in the expected:

jchase@tethys test_regression $ rustup default nightly-2016-10-21 && time rustc src/lib.rs; echo -e '\n\n'; rustup default nightly && time rustc src/lib.rs
info: using existing install for 'nightly-2016-10-21-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2016-10-21-x86_64-unknown-linux-gnu'

  nightly-2016-10-21-x86_64-unknown-linux-gnu unchanged - rustc 1.14.0-nightly (f09420685 2016-10-20)


real	0m0.172s
user	0m0.133s
sys	0m0.033s



info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'

  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.14.0-nightly (5665bdf3e 2016-11-02)


real	0m0.181s
user	0m0.163s
sys	0m0.007s
@oli-obk
Copy link
Contributor

oli-obk commented Nov 5, 2016

It's not just rustc. If a run-pass test fails with compiletest-rs, the same hang can be seen for reporting the stacktrace of the failed test

@jrobsonchase
Copy link
Author

Any movement on this? Still seeing the same behavior on nightly - stable and beta are fine.

@jrobsonchase
Copy link
Author

jrobsonchase commented Nov 11, 2016

Just a little more information: When I compile rust myself, I don't see the issue - even from the same commit. strace shows a huge jump in calls to mmap during the hang-time from ~600 calls with beta to ~9000 calls with nightly.

Edit: Scratch the caveat around compiling it myself - I was doing it wrong.

@sfackler
Copy link
Member

I think someone ran into something similar before and it ended up being an issue with libbacktrace's custom allocator implementation.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 11, 2017
In rust-lang#37280 we enabled line number debugging information in release artifacts,
primarily to close out rust-lang#36452 where debugging information was critical for MSVC
builds of Rust to be useful in production. This commit, however, apparently had
some unfortunate side effects.

Namely it was noticed in rust-lang#37477 that if `RUST_BACKTRACE=1` was set then any
compiler error would take a very long time for the compiler to exit. The cause
of the problem here was somewhat deep:

* For all compiler errors, the compiler will `panic!` with a known value. This
  tears down the main compiler thread and allows cleaning up all the various
  resources. By default, however, this panic output is suppressed for "normal"
  compiler errors.
* When `RUST_BACKTRACE=1` was set this caused every compiler error to generate a
  backtrace.
* The libbacktrace library hits a pathological case where it spends a very long
  time in its custom allocation function, `backtrace_alloc`, because the
  compiler has so much debugging information. More information about this can be
  found in rust-lang#29293 with a summary at the end of rust-lang#37477.

To solve this problem this commit simply removes debuginfo from the compiler but
not from the standard library. This should allow us to keep rust-lang#36452 closed while
also closing rust-lang#37477. I've measured the difference to be orders of magnitude
faster than it was before, so we should see a much quicker time-to-exit after a
compile error when `RUST_BACKTRACE=1` is set.

Closes rust-lang#37477
Closes rust-lang#37571
bors added a commit that referenced this issue Jan 11, 2017
rustbuild: Don't enable debuginfo in rustc

In #37280 we enabled line number debugging information in release artifacts,
primarily to close out #36452 where debugging information was critical for MSVC
builds of Rust to be useful in production. This commit, however, apparently had
some unfortunate side effects.

Namely it was noticed in #37477 that if `RUST_BACKTRACE=1` was set then any
compiler error would take a very long time for the compiler to exit. The cause
of the problem here was somewhat deep:

* For all compiler errors, the compiler will `panic!` with a known value. This
  tears down the main compiler thread and allows cleaning up all the various
  resources. By default, however, this panic output is suppressed for "normal"
  compiler errors.
* When `RUST_BACKTRACE=1` was set this caused every compiler error to generate a
  backtrace.
* The libbacktrace library hits a pathological case where it spends a very long
  time in its custom allocation function, `backtrace_alloc`, because the
  compiler has so much debugging information. More information about this can be
  found in #29293 with a summary at the end of #37477.

To solve this problem this commit simply removes debuginfo from the compiler but
not from the standard library. This should allow us to keep #36452 closed while
also closing #37477. I've measured the difference to be orders of magnitude
faster than it was before, so we should see a much quicker time-to-exit after a
compile error when `RUST_BACKTRACE=1` is set.

Closes #37477
Closes #37571
brson pushed a commit to brson/rust that referenced this issue Jan 17, 2017
In rust-lang#37280 we enabled line number debugging information in release artifacts,
primarily to close out rust-lang#36452 where debugging information was critical for MSVC
builds of Rust to be useful in production. This commit, however, apparently had
some unfortunate side effects.

Namely it was noticed in rust-lang#37477 that if `RUST_BACKTRACE=1` was set then any
compiler error would take a very long time for the compiler to exit. The cause
of the problem here was somewhat deep:

* For all compiler errors, the compiler will `panic!` with a known value. This
  tears down the main compiler thread and allows cleaning up all the various
  resources. By default, however, this panic output is suppressed for "normal"
  compiler errors.
* When `RUST_BACKTRACE=1` was set this caused every compiler error to generate a
  backtrace.
* The libbacktrace library hits a pathological case where it spends a very long
  time in its custom allocation function, `backtrace_alloc`, because the
  compiler has so much debugging information. More information about this can be
  found in rust-lang#29293 with a summary at the end of rust-lang#37477.

To solve this problem this commit simply removes debuginfo from the compiler but
not from the standard library. This should allow us to keep rust-lang#36452 closed while
also closing rust-lang#37477. I've measured the difference to be orders of magnitude
faster than it was before, so we should see a much quicker time-to-exit after a
compile error when `RUST_BACKTRACE=1` is set.

Closes rust-lang#37477
Closes rust-lang#37571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants