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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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 😓.

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.

2 participants