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

Fix error handling when looking for toolchain components #2021

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

lqd
Copy link
Member

@lqd lqd commented Dec 15, 2024

The perf collector failed weirdly in rust-lang/rust#134297 (comment). It failed when the collector was trying to gather PGO data, with a very terse error: collector error: Cannot read lib dir to find components.

So this PR:

  • adds some context on which directory was being read if an error happens in fill_libraries
  • fixes the error handling in get_lib_dir_from_rustc which didn't check that rustc --print sysroot successfully returned the sysroot, it'll print the exit status and stderr.
  • adds a check that the returned sysroot also exists, just in case

With these we can see that the error was a cute one, the stage2 rustc panicked when asked to print the sysroot. So the error in the CI logs would now look like:

Running with 1 job(s)
collector error: Cannot find libdir for rustc

Caused by:
    rustc failed to provide sysroot, exit status: exit status: 101
    stderr: thread 'main' panicked at compiler/rustc_driver_impl/src/lib.rs:1587:6:
    Unable to install ctrlc handler: System(Custom { kind: Other, error: EBADF })
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::result::unwrap_failed
       3: rustc_driver_impl::install_ctrlc_handler
       4: rustc_driver_impl::main
       5: rustc_main::main
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

    note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

    note: please make sure that you have updated to the latest nightly

    note: please attach the file at `/tmp/tmp-multistage/opt-artifacts/rustc-perf/rustc-ice-2024-12-15T18_31_39-82730.txt` to your bug report

    query stack during panic:
    end of query stack

[2024-12-15T18:31:39.841Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Gather profiles` ended: FAIL (0.30s)`

Once this lands, I'll bump the submodule in the rust repo so that CI has the new error handling, in case it happens again in the PRs trying to land the same changes that may currently cause a miscompile 😓.

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Kobzol Kobzol merged commit e22e086 into rust-lang:master Jan 9, 2025
11 checks passed
@lqd lqd deleted the lib-dir branch January 9, 2025 16:46
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
bump `rustc-perf` submodule

This updates the `rustc-perf` submodule to pull in the recent changes, in particular the error handling in rust-lang/rustc-perf#2021 fixing the error we saw in a recent run.

I think I did this correctly, submodules are so annoying.

r? kobzol

(opening as draft to do a perf run and check that nothing has changed indeed)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2025
bump `rustc-perf` submodule

This updates the `rustc-perf` submodule to pull in the recent changes, in particular the error handling in rust-lang/rustc-perf#2021 fixing the error we saw in a recent run.

I think I did this correctly, submodules are so annoying.

r? kobzol

(opening as draft to do a perf run and check that nothing has changed indeed)
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 this pull request may close these issues.

3 participants