rust-lang / rust-lang/rust

bootstrap: Canceling rustc download poisons the cache

Open
#142,161 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I don't know what's different from my other checkouts, but in one of my checkouts, extracting the downloaded rustc is somehow broken:

$ ./x test library/core -- pin
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
extracting /home/r/src/rust/rustc/build/cache/321dde12528a6baf0990ec611d33122b68c33fca-false/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/ci-rustc
extracting /home/r/src/rust/rustc/build/cache/321dde12528a6baf0990ec611d33122b68c33fca-false/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/ci-rustc

thread 'main' panicked at src/bootstrap/src/core/download.rs:345:17:
member.unpack_in(dst) failed with failed to unpack `/home/r/src/rust/rustc/build/x86_64-unknown-linux-gnu/ci-rustc/rustc-nightly-x86_64-unknown-linux-gnu/rustc/lib/librustc_driver-ef85d6b35b33584e.so`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Panic was initiated from src/bootstrap/src/core/download.rs:345:17
Build completed unsuccessfully in 0:00:02

My HEAD is 321dde12528a6baf0990ec611d33122b68c33fca, unchanged. I get the same result with ./x check library --stage 1 so it's not just test; that same command works fine in other checkouts.

The backtrace does not seem like it'd help much:

stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/core/src/panicking.rs:75:14
   2: bootstrap::core::download::<impl bootstrap::core::config::config::Config>::unpack
             at ./src/bootstrap/src/utils/helpers.rs:57:23
   3: bootstrap::core::download::<impl bootstrap::core::config::config::Config>::download_component
             at ./src/bootstrap/src/core/download.rs:694:13
   4: bootstrap::core::download::<impl bootstrap::core::config::config::Config>::download_ci_component
             at ./src/bootstrap/src/core/download.rs:616:9
   5: bootstrap::core::download::<impl bootstrap::core::config::config::Config>::download_toolchain
             at ./src/bootstrap/src/core/download.rs:587:13
   6: bootstrap::core::download::<impl bootstrap::core::config::config::Config>::download_ci_rustc
             at ./src/bootstrap/src/core/download.rs:532:9
   7: bootstrap::core::config::config::Config::download_rustc_commit::{{closure}}
             at ./src/bootstrap/src/core/config/config.rs:1204:21
   8: std::sync::once_lock::OnceLock<T>::get_or_init::{{closure}}
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/once_lock.rs:310:50
   9: std::sync::once_lock::OnceLock<T>::initialize::{{closure}}
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/once_lock.rs:518:19
  10: std::sync::poison::once::Once::call_once_force::{{closure}}
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/poison/once.rs:214:40
  11: std::sys::sync::once::futex::Once::call
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sys/sync/once/futex.rs:176:21
  12: std::sync::poison::once::Once::call_once_force
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/poison/once.rs:214:9
  13: std::sync::once_lock::OnceLock<T>::initialize
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/once_lock.rs:517:9
  14: std::sync::once_lock::OnceLock<T>::get_or_try_init
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/once_lock.rs:396:9
  15: std::sync::once_lock::OnceLock<T>::get_or_init
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/std/src/sync/once_lock.rs:310:15
  16: bootstrap::core::config::config::Config::download_rustc_commit
             at ./src/bootstrap/src/core/config/config.rs:1200:9
  17: bootstrap::core::config::config::Config::download_rustc
             at ./src/bootstrap/src/core/config/config.rs:1190:9
  18: bootstrap::Build::download_rustc
             at ./src/bootstrap/src/lib.rs:314:17
  19: bootstrap::core::builder::StepDescription::run
             at ./src/bootstrap/src/core/builder/mod.rs:468:12
  20: bootstrap::core::builder::Builder::run_step_descriptions
             at ./src/bootstrap/src/core/builder/mod.rs:1232:9
  21: bootstrap::core::builder::Builder::execute_cli
             at ./src/bootstrap/src/core/builder/mod.rs:1212:9
  22: bootstrap::Build::build
             at ./src/bootstrap/src/lib.rs:686:17
  23: bootstrap::main
             at ./src/bootstrap/src/bin/main.rs:99:5
  24: core::ops::function::FnOnce::call_once
             at /rustc/95597e848d27a82b8864c677ab807e9f0be1f68c/library/core/src/ops/function.rs:250:5

Cc @onur-ozkan

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/bootstrap/src/core/download.rs at the unpack failure, then trace the download flow through src/bootstrap/src/core/config/config.rs and src/bootstrap/src/utils/helpers.rs. Reproduce with ./x test library/core -- pin or ./x check library --stage 1 and inspect behavior after canceling the rustc download. Done means an interrupted download no longer leaves the cache unusable for later runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.