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

Panic while compiling http-body v0.4.6 with rustc 1.83.0-nightly (7042c269c 2024-09-23) #130769

Closed
arpankapoor opened this issue Sep 24, 2024 · 11 comments · May be fixed by #130786
Closed

Panic while compiling http-body v0.4.6 with rustc 1.83.0-nightly (7042c269c 2024-09-23) #130769

arpankapoor opened this issue Sep 24, 2024 · 11 comments · May be fixed by #130786
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arpankapoor
Copy link
Contributor

arpankapoor commented Sep 24, 2024

Code

Clone http-body, checkout v0.4.6 and compile in release mode:

$ git clone https://github.com/hyperium/http-body.git
$ cd http-body
$ git checkout v0.4.6
$ cargo build --release

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (7042c269c 2024-09-23)
binary: rustc
commit-hash: 7042c269c166191cd5d8daf0409890903df7af57
commit-date: 2024-09-23
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:152:26:
broken MIR in Item(DefId(0:23 ~ http_body[d100]::collect::{impl#1}::poll)) (after phase change to runtime-optimized) at bb22[2]:
Normal edge to BasicBlockData { statements: [StorageDead(_46)], terminator: Some(Terminator { source_info: SourceInfo { span: src/collect.rs:69:13: 69:14 (#0), scope: scope[1] }, kind: goto -> bb41 }), is_cleanup: false } violates unwind invariants (cleanup true -> false)
stack backtrace:
   0:     0x7fe9e4c02f25 - std::backtrace::Backtrace::create::h8d365723131839b0
   1:     0x7fe9e32738a5 - std::backtrace::Backtrace::force_capture::ha8b2c128ac653152
   2:     0x7fe9e2382ea4 - std[25b33fdea409b280]::panicking::update_hook::<alloc[1694921db2598cc8]::boxed::Box<rustc_driver_impl[91319f0e19a4d720]::install_ice_hook::{closure#0}>>::{closure#0}
   3:     0x7fe9e328b018 - std::panicking::rust_panic_with_hook::hfa739d875be2cf67
   4:     0x7fe9e328adea - std::panicking::begin_panic_handler::{{closure}}::h9a9134f6e05b41bd
   5:     0x7fe9e32887d9 - std::sys::backtrace::__rust_end_short_backtrace::h35fa4dfdd9fe9e0c
   6:     0x7fe9e328aaac - rust_begin_unwind
   7:     0x7fe9e0a9e7b0 - core::panicking::panic_fmt::hc3e7c6c5c469a97f
   8:     0x7fe9e10b311a - <rustc_mir_transform[2c59a960358d0625]::validate::Validator as rustc_mir_transform[2c59a960358d0625]::pass_manager::MirPass>::run_pass
   9:     0x7fe9e3a0dc64 - rustc_mir_transform[2c59a960358d0625]::pass_manager::run_passes_inner
  10:     0x7fe9e4403922 - rustc_mir_transform[2c59a960358d0625]::optimized_mir
  11:     0x7fe9e44021db - rustc_query_impl[16add4a89c515f02]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16add4a89c515f02]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>
  12:     0x7fe9e3a31eae - rustc_query_system[cd92c81c02f5c019]::query::plumbing::try_execute_query::<rustc_query_impl[16add4a89c515f02]::DynamicConfig<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[16add4a89c515f02]::plumbing::QueryCtxt, false>
  13:     0x7fe9e3a3145f - rustc_query_impl[16add4a89c515f02]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  14:     0x7fe9e440e963 - rustc_middle[5962dfe9f3174182]::query::plumbing::query_get_at::<rustc_query_system[cd92c81c02f5c019]::query::caches::DefIdCache<rustc_middle[5962dfe9f3174182]::query::erase::Erased<[u8; 8usize]>>>
  15:     0x7fe9e4416305 - <rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::EncodeContext>::encode_crate_root
  16:     0x7fe9e4ab8ad3 - rustc_metadata[bda71c6b2cfd99ea]::rmeta::encoder::encode_metadata
  17:     0x7fe9e4ac0f54 - rustc_metadata[bda71c6b2cfd99ea]::fs::encode_and_write_metadata
  18:     0x7fe9e4abfd43 - <rustc_interface[1294e3f809d58823]::queries::Linker>::codegen_and_build_linker
  19:     0x7fe9e472a34b - rustc_interface[1294e3f809d58823]::interface::run_compiler::<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}
  20:     0x7fe9e47bf210 - std[25b33fdea409b280]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1294e3f809d58823]::util::run_in_thread_with_globals<rustc_interface[1294e3f809d58823]::util::run_in_thread_pool_with_globals<rustc_interface[1294e3f809d58823]::interface::run_compiler<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>
  21:     0x7fe9e47bf87a - <<std[25b33fdea409b280]::thread::Builder>::spawn_unchecked_<rustc_interface[1294e3f809d58823]::util::run_in_thread_with_globals<rustc_interface[1294e3f809d58823]::util::run_in_thread_pool_with_globals<rustc_interface[1294e3f809d58823]::interface::run_compiler<core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>, rustc_driver_impl[91319f0e19a4d720]::run_compiler::{closure#0}>::{closure#1}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1e18fbba9f4dcc19]::result::Result<(), rustc_span[d14b83658cea8543]::ErrorGuaranteed>>::{closure#1} as core[1e18fbba9f4dcc19]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x7fe9e47bfc6b - std::sys::pal::unix::thread::Thread::new::thread_start::h9c0c387d4b02e16a
  23:     0x7fe9e5fd16d7 - start_thread
  24:     0x7fe9e605560c - __clone3
  25:                0x0 - <unknown>


rustc version: 1.83.0-nightly (7042c269c 2024-09-23)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [optimized_mir] optimizing MIR for `collect::<impl at src/collect.rs:37:1: 37:36>::poll`
end of query stack
Backtrace

<backtrace>

@arpankapoor arpankapoor 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 Sep 24, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 24, 2024
@theemathas
Copy link
Contributor

theemathas commented Sep 24, 2024

Minimized:

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}

Run cargo +nightly build --release to reproduce the ICE

@theemathas
Copy link
Contributor

@rustbot labels +regression-from-stable-to-nightly

@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 24, 2024
@jieyouxu
Copy link
Member

searched nightlies: from nightly-2024-09-20 to nightly-2024-09-24
regressed nightly: nightly-2024-09-24
searched commit range: 6c6d210...7042c26
regressed commit: a772336

bisected with cargo-bisect-rustc v0.6.8

Host triple: aarch64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress=ice -- build --release

@jieyouxu jieyouxu added A-mir-opt Area: MIR optimizations S-has-bisection Status: a bisection has been found for this issue labels Sep 24, 2024
@jieyouxu
Copy link
Member

Might be #129047 cc @DianQK

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 24, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this issue Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
@jieyouxu

This comment has been minimized.

jieyouxu added a commit to jieyouxu/rust that referenced this issue Sep 24, 2024
…h_scalar, r=cjgillot"

This reverts commit a772336, reversing
changes made to 702987f.

It seems Apply EarlyOtherwiseBranch to scalar value rust-lang#129047 may have
lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

And since this is a mir-opt ICE that seems to quite easy to trigger with
real-world crates being affected, let's revert for now and reland the
mir-opt later.
jieyouxu added a commit to jieyouxu/rust that referenced this issue Sep 24, 2024
@jieyouxu

This comment has been minimized.

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
@HTGAzureX1212
Copy link
Contributor

HTGAzureX1212 commented Sep 24, 2024

Just encountered this now, posting the GitHub Actions log: https://github.com/HTGAzureX1212/HarTex/actions/runs/11014828619/job/30586387526

This seems to not only be happening to http-body but to some other crates as well (in the log above, twilight-http).

@theemathas
Copy link
Contributor

The problematic part of twilight-http has the exact same pattern of nested match patterns https://github.com/twilight-rs/twilight/blob/9147a49e2f96f4cde9be3fc48dda42dd5fecd3e1/twilight-http/src/response/future.rs#L84

@DianQK
Copy link
Member

DianQK commented Sep 24, 2024

#130786 should fix this. I will rebase after #130775 merged.

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value rust-lang#129047"

This reverts PR rust-lang#129047, commit a772336, reversing changes made to 702987f.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of rust-lang#129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value rust-lang#129047](rust-lang#129047) may have lead to several nightly regressions:

- rust-lang#130769
- rust-lang#130774
- rust-lang#130771

Example test that would ICE with changes in rust-lang#129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
SimonSapin added a commit to apollographql/router that referenced this issue Sep 24, 2024
We use Rust nightly on CI in order to check that fuzz targets can still compile.
With current latest nightly we’re running into a compiler panic:
rust-lang/rust#130769

To unblock merging PRs, this pins the nightly version used on CI
to a slightly older one that does not have this panic.
This should be reverted after the panic is fixed in a new Rust nightly.
github-merge-queue bot pushed a commit to tari-project/sha-p2pool that referenced this issue Sep 24, 2024
Description
---
A very recent rust nightly issue came up and make our build broken:
rust-lang/rust#130769

Motivation and Context
---

How Has This Been Tested?
---

What process can a PR reviewer use to test or verify this change?
---

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
SimonSapin added a commit to apollographql/router that referenced this issue Sep 24, 2024
We use Rust nightly on CI in order to check that fuzz targets can still compile. With current latest nightly we’re running into a compiler panic: rust-lang/rust#130769

To unblock merging PRs, this pins the nightly version used on CI to a slightly older one that does not have this panic. This should be reverted after the panic is fixed in a new Rust nightly.
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 25, 2024
Revert "Apply EarlyOtherwiseBranch to scalar value #129047"

This reverts PR #129047, commit a772336fb3fbd1fe4493077fcfe04e0221296a99, reversing changes made to 702987f75b74f789ba227ee04a3d7bb1680c2309.

cc `@DianQK` and `@cjgillot` as the PR author and reviewer of #129047 respectively.

It seems [Apply EarlyOtherwiseBranch to scalar value #129047](rust-lang/rust#129047) may have lead to several nightly regressions:

- rust-lang/rust#130769
- rust-lang/rust#130774
- rust-lang/rust#130771

Example test that would ICE with changes in #129047 (this test is included in this PR):

```rs
//@ compile-flags: -C opt-level=3
//@ check-pass

use std::task::Poll;

pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) {
    match val {
        Poll::Ready(Ok(Some(_trailers))) => {}
        Poll::Ready(Err(_err)) => {}
        Poll::Ready(Ok(None)) => {}
        Poll::Pending => {}
    }
}
```

Since this is a mir-opt ICE that seems to quite easy to trigger with real-world crates being affected, let's revert for now and reland the mir-opt after these are fixed.
@wesleywiser
Copy link
Member

Fixed by #130775 which reverted the change and added the minimized reproducer to the test suite. Thanks @jieyouxu!

SimonSapin added a commit to apollographql/router that referenced this issue Sep 30, 2024
SimonSapin added a commit to apollographql/router that referenced this issue Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants