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

bootstrap of cargo broken: assertion failed: sentinel == STR_SENTINEL, compiler/rustc_serialize/src/opaque.rs:669:9 #91663

Closed
matthiaskrgr opened this issue Dec 8, 2021 · 12 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Dec 8, 2021

EDIT2:
should be fixed with nightly 2021-12-11

EDIT:
FOR EVERYONE THAT IS ALSO GETTING THIS:
Try cleaning your build artifacts: cargo clean, in most cases the crash should go away after a rebuild.


#91407 added an assertion that triggers on me doing a bootstrap and building cargo:

Updating only changed submodules
Submodules updated in 0.01 seconds
    Finished dev [unoptimized] target(s) in 0.14s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.20s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.20s
Copying stage0 rustc from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Assembling stage1 compiler (x86_64-unknown-linux-gnu)
Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.18s
Copying stage1 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.19s
Copying stage1 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage1 tool cargo (x86_64-unknown-linux-gnu)
   Compiling url v2.2.2
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `193`', /home/matthias/vcs/github/rust/compiler/rustc_serialize/src/opaque.rs:669:9

repo @ 11fb21f

Backtrace

Building stage1 tool cargo (x86_64-unknown-linux-gnu)
   Compiling url v2.2.2
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `193`', /home/matthias/vcs/github/rust/compiler/rustc_serialize/src/opaque.rs:669:9
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<u8, u8>
   4: <rustc_metadata::rmeta::decoder::DecodeContext as rustc_serialize::serialize::Decoder>::read_str
   5: <rustc_metadata::rmeta::Lazy<alloc::string::String, ()>>::decode::<&rustc_metadata::rmeta::decoder::MetadataBlob>
   6: <rustc_metadata::locator::CrateLocator>::extract_one
   7: <rustc_metadata::locator::CrateLocator>::extract_lib
   8: <rustc_metadata::locator::CrateLocator>::find_library_crate
   9: <rustc_metadata::locator::CrateLocator>::maybe_load_library_crate
  10: <rustc_metadata::creader::CrateLoader>::load
  11: <rustc_metadata::creader::CrateLoader>::maybe_resolve_crate
  12: <rustc_metadata::creader::CrateLoader>::maybe_resolve_crate
  13: <rustc_metadata::creader::CrateLoader>::resolve_crate
  14: <rustc_metadata::creader::CrateLoader>::process_extern_crate
  15: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
  16: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  17: <rustc_expand::expand::MacroExpander>::collect_invocations
  18: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
  19: <rustc_expand::expand::MacroExpander>::expand_crate
  20: rustc_interface::passes::configure_and_expand
  21: <rustc_interface::queries::Queries>::expansion
  22: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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: rustc 1.59.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z symbol-mangling-version=v0 -Z macro-backtrace -Z tls-model=initial-exec -Z binary-dep-depinfo -C opt-level=3 -C embed-bitcode=no -C codegen-units=4 -C debuginfo=0 -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type rlib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `url`
Build completed unsuccessfully in 0:00:02

I'm using sccache in case that matters.

cc @the8472

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 8, 2021
@the8472
Copy link
Member

the8472 commented Dec 8, 2021

The output looks like nothing is getting rebuilt, but I would expect the stage1 compiler getting built if you pulled a new master. Something is caching too aggressively?

@matthiaskrgr
Copy link
Member Author

Hmm, I wonder if it is a mix of using sccache + sharing target dir between different crates (rustc tools) that causes the problem.

@the8472
Copy link
Member

the8472 commented Dec 8, 2021

I did encounter such an issue myself while working on the PR but doing ./x.py clean solved the issue. But that wasn't unexpected since I changed the serialization format of the compiler, thus making existing serialized data invalid.

But my understanding is that this should only affect rustc developers because the rustc build version doesn't change. For CI builds the git commit should differ and thus the cached data should be discarded as coming from a different compiler version.

@matthiaskrgr
Copy link
Member Author

I've wiped my sccache and rustc build cache and have not seen the issue since, but there seem to be a lot of other people having similar problems, hm.

@the8472
Copy link
Member

the8472 commented Dec 9, 2021

So it's probably a missing cache invalidation and my assumption that it's keyed on the compiler version is wrong.

@kov
Copy link

kov commented Dec 9, 2021

Just hit this issue building a personal project (it was building the derive_builder_core crate). The cause is apparently that I was building with the stable release channel and got this error:

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> offload-daemon/src/main.rs:1:1
  |
1 | #![feature(async_closure)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Then I switched to the nightly channel and retried the build, got this panic. The panic went away when I removed the target/ dir and rebuilt.

the8472 added a commit to the8472/rust that referenced this issue Dec 9, 2021
rust-lang#91407 changed the serialization format which leads to ICEs for nightly users such as rust-lang#91663 and linked issue.
Bumping the metadata version should lead to the cached files being discarded instead.
@kaimast
Copy link

kaimast commented Dec 9, 2021

I got this issue after moving my home directory to a new install. My guess is some of the permissions got messed up. I already tried cargo clean reinstalling all toolchains with rustup and deleting the target directories.

What is the "sccache" and how do I clean it?

@matthiaskrgr
Copy link
Member Author

sccache is a (distributed/local) build cache that can be used with cargo/rustc (but also clang gcc etc).
https://github.com/mozilla/sccache

If you want to purge it should be save to just remove the content of ~/.cache/sccache but if you don't know what it is, you probably never set it up and are not using it I guess.

@kaimast
Copy link

kaimast commented Dec 9, 2021

Oh yeah I don't use that. I just removed ~/.cargo and reinstalled everything using rustup but still keep running into this.

Any idea how to do debug or what logs to provide to this report?

@matthiaskrgr
Copy link
Member Author

"~/.cargo" is the cargo download/source cache, should be unrelated to this issue. 😅

The issue should be fixed once #91715 is shipped in a new nightly compiler.

For now you can probably pin to yesterdays nightly 2021-12-07 until the bug is fixed:
https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
The channel line would be yesterdays nightly I think:
channel = "nightly-2021-12-07"

@martinellison

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this issue Dec 11, 2021
…Mark-Simulacrum

Bump rmeta version to fix rustc_serialize ICE

rust-lang#91407 changed the serialization format which leads to ICEs for nightly users such as rust-lang#91663 and linked issues. The issue can be solved by running `cargo clean`. But bumping the metadata version should lead to the cached files being discarded, avoiding the issue entirely.
@matthiaskrgr
Copy link
Member Author

#91715 has been merged, closing.

jfhbrook-at-work pushed a commit to eaze/tracing-honeycomb that referenced this issue Dec 20, 2021
There's a bug in nightly where the workaround is to run `cargo clean`:

rust-lang/rust#91663
jfhbrook-at-work pushed a commit to eaze/tracing-honeycomb that referenced this issue Dec 21, 2021
There's a bug in nightly where the workaround is to run `cargo clean`:

rust-lang/rust#91663
pfoneill added a commit to pfoneill/G-CLI that referenced this issue Aug 23, 2024
This fixes issue caught by clippy rust-lang/rust#91663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

5 participants