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

backtrace missing from file #113881

Closed
matthiaskrgr opened this issue Jul 20, 2023 · 8 comments · Fixed by #114128
Closed

backtrace missing from file #113881

matthiaskrgr opened this issue Jul 20, 2023 · 8 comments · Fixed by #114128
Labels
C-bug Category: This is a bug. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Sometimes when rustc dumps an ICE backtrace to disk, the file only contains



rustc version: 1.73.0-nightly (0646a5d1a 2023-07-20)
platform: x86_64-unknown-linux-gnu

I have yet to find what actual file/ice causes this, its a bit tricky since there is no mapping from ice file to the actual .rs that was used to cause the ICE.

cc @estebank

@matthiaskrgr matthiaskrgr added the C-bug Category: This is a bug. label Jul 20, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 20, 2023
@estebank
Copy link
Contributor

Is this from a test case in the suite that's ICEing? I would like to try and reproduce this.

@estebank estebank added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. labels Jul 20, 2023
@matthiaskrgr
Copy link
Member Author

It looks like this is related to panics that happen during panics:

#113211

With that file and the listed flags, you will get 3 stacktraces in stderr, but only one in the file:

thread 'rustc' panicked at 'panic in a function that cannot unwind', library/core/src/panicking.rs:126:5
stack backtrace:
   0:     0x7f47a7762eb1 - std::backtrace_rs::backtrace::libunwind::trace::h1ef044f8a76bc58e
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f47a7762eb1 - std::backtrace_rs::backtrace::trace_unsynchronized::hc89d616b4a62f3db
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f47a7762eb1 - std::sys_common::backtrace::_print_fmt::h96b055d0bb0a7069
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f47a7762eb1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6a9ae02f5e47ee59
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f47a77c920c - core::fmt::rt::Argument::fmt::h58c2fd6f19f6b85c
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/core/src/fmt/rt.rs:138:9
   5:     0x7f47a77c920c - core::fmt::write::he78a1e727f7f3a28
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f47a77557be - std::io::Write::write_fmt::hfeb3f257b56c25f4
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/io/mod.rs:1714:15
   7:     0x7f47a7762cc5 - std::sys_common::backtrace::_print::h95d62e038e428dd1
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f47a7762cc5 - std::sys_common::backtrace::print::ha91d2cb749a45cfd
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f47a7765d1a - std::panicking::panic_hook_with_disk_dump::{{closure}}::hf44f3c5daaada0e7
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/panicking.rs:278:22
  10:     0x7f47a7765886 - std::panicking::panic_hook_with_disk_dump::hded179893093690a
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/panicking.rs:305:9
  11:     0x7f47aa973149 - rustc_driver_impl[73dfa8b3f1700d5b]::install_ice_hook::{closure#0}
  12:     0x7f47a77665c0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h52df155e44955457
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2021:9
  13:     0x7f47a77665c0 - std::panicking::rust_panic_with_hook::h850f202a77b42b93
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/panicking.rs:733:13
  14:     0x7f47a7766301 - std::panicking::begin_panic_handler::{{closure}}::h964a2a7452a9f2bc
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/panicking.rs:619:13
  15:     0x7f47a7763316 - std::sys_common::backtrace::__rust_end_short_backtrace::h11fb79d7f7c4cd25
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f47a7766092 - rust_begin_unwind
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/panicking.rs:617:5
  17:     0x7f47a77c55f3 - core::panicking::panic_nounwind_fmt::h4ac05c03e7ba0051
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/core/src/panicking.rs:96:14
  18:     0x7f47a77c5697 - core::panicking::panic_nounwind::hc5a94ab1592212b2
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/core/src/panicking.rs:126:5
  19:     0x7f47a77c5823 - core::panicking::panic_cannot_unwind::h542d29abadb0c373
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/core/src/panicking.rs:189:5
  20:     0x7f47a97fa08b - rustc_borrowck[403818351f66e70f]::mir_borrowck
  21:     0x7f47a8a5a93e - rustc_query_impl[3b38d3732de95ba4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b38d3732de95ba4]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7f47a8a5a90e - <rustc_query_impl[3b38d3732de95ba4]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[222739805fe3bed]::ops::function::FnOnce<(rustc_middle[8fd494d35938793c]::ty::context::TyCtxt, rustc_span[9451958236a7e67c]::def_id::LocalDefId)>>::call_once
  23:     0x7f47a8b3c2fd - rustc_query_system[83bbfedd71665807]::query::plumbing::try_execute_query::<rustc_query_impl[3b38d3732de95ba4]::DynamicConfig<rustc_query_system[83bbfedd71665807]::query::caches::VecCache<rustc_span[9451958236a7e67c]::def_id::LocalDefId, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3b38d3732de95ba4]::plumbing::QueryCtxt, false>
  24:     0x7f47aa2f49ff - rustc_query_impl[3b38d3732de95ba4]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7f47a9b2ae3d - rustc_hir_analysis[6737c73d6b1d4c93]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
  26:     0x7f47a9b27791 - rustc_hir_analysis[6737c73d6b1d4c93]::collect::type_of::type_of
  27:     0x7f47a8b453a3 - rustc_query_impl[3b38d3732de95ba4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b38d3732de95ba4]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f47a8b45360 - <rustc_query_impl[3b38d3732de95ba4]::query_impl::type_of::dynamic_query::{closure#2} as core[222739805fe3bed]::ops::function::FnOnce<(rustc_middle[8fd494d35938793c]::ty::context::TyCtxt, rustc_span[9451958236a7e67c]::def_id::DefId)>>::call_once
  29:     0x7f47a8a50705 - rustc_query_system[83bbfedd71665807]::query::plumbing::try_execute_query::<rustc_query_impl[3b38d3732de95ba4]::DynamicConfig<rustc_query_system[83bbfedd71665807]::query::caches::DefaultCache<rustc_span[9451958236a7e67c]::def_id::DefId, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3b38d3732de95ba4]::plumbing::QueryCtxt, false>
  30:     0x7f47aa2e85ef - rustc_query_impl[3b38d3732de95ba4]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f47a9d60736 - rustc_middle[8fd494d35938793c]::query::plumbing::query_get_at::<rustc_query_system[83bbfedd71665807]::query::caches::DefaultCache<rustc_span[9451958236a7e67c]::def_id::DefId, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 8usize]>>>
  32:     0x7f47a9d5baa7 - rustc_hir_analysis[6737c73d6b1d4c93]::check::check::check_mod_item_types
  33:     0x7f47a970a9dc - rustc_query_impl[3b38d3732de95ba4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b38d3732de95ba4]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 0usize]>>
  34:     0x7f47a970a9be - <rustc_query_impl[3b38d3732de95ba4]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[222739805fe3bed]::ops::function::FnOnce<(rustc_middle[8fd494d35938793c]::ty::context::TyCtxt, rustc_span[9451958236a7e67c]::def_id::LocalDefId)>>::call_once
  35:     0x7f47a91ae0ef - rustc_query_system[83bbfedd71665807]::query::plumbing::try_execute_query::<rustc_query_impl[3b38d3732de95ba4]::DynamicConfig<rustc_query_system[83bbfedd71665807]::query::caches::VecCache<rustc_span[9451958236a7e67c]::def_id::LocalDefId, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[3b38d3732de95ba4]::plumbing::QueryCtxt, false>
  36:     0x7f47aa2f2f42 - rustc_query_impl[3b38d3732de95ba4]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f47a9e48d37 - <rustc_middle[8fd494d35938793c]::hir::map::Map>::for_each_module::<rustc_hir_analysis[6737c73d6b1d4c93]::check_crate::{closure#6}::{closure#0}>
  38:     0x7f47a9e4838d - <rustc_session[897f8a30474c07a2]::session::Session>::time::<(), rustc_hir_analysis[6737c73d6b1d4c93]::check_crate::{closure#6}>
  39:     0x7f47a9e480e3 - rustc_hir_analysis[6737c73d6b1d4c93]::check_crate
  40:     0x7f47a9e4787a - rustc_interface[1efc0c1d63102c92]::passes::analysis
  41:     0x7f47a9e5653a - rustc_query_impl[3b38d3732de95ba4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b38d3732de95ba4]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 1usize]>>
  42:     0x7f47a9e56529 - <rustc_query_impl[3b38d3732de95ba4]::query_impl::analysis::dynamic_query::{closure#2} as core[222739805fe3bed]::ops::function::FnOnce<(rustc_middle[8fd494d35938793c]::ty::context::TyCtxt, ())>>::call_once
  43:     0x7f47a9fe6c48 - rustc_query_system[83bbfedd71665807]::query::plumbing::try_execute_query::<rustc_query_impl[3b38d3732de95ba4]::DynamicConfig<rustc_query_system[83bbfedd71665807]::query::caches::SingleCache<rustc_middle[8fd494d35938793c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[3b38d3732de95ba4]::plumbing::QueryCtxt, false>
  44:     0x7f47a9fe69d7 - rustc_query_impl[3b38d3732de95ba4]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f47a9fb2025 - <rustc_middle[8fd494d35938793c]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>
  46:     0x7f47a9b9d569 - rustc_span[9451958236a7e67c]::set_source_map::<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_interface[1efc0c1d63102c92]::interface::run_compiler<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  47:     0x7f47a9b97227 - std[637671632e4d6836]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1efc0c1d63102c92]::util::run_in_thread_pool_with_globals<rustc_interface[1efc0c1d63102c92]::interface::run_compiler<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}>::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>
  48:     0x7f47aa1d26ee - <<std[637671632e4d6836]::thread::Builder>::spawn_unchecked_<rustc_interface[1efc0c1d63102c92]::util::run_in_thread_pool_with_globals<rustc_interface[1efc0c1d63102c92]::interface::run_compiler<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}>::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#1} as core[222739805fe3bed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7f47a7770cb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33d48cbded0f44d0
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  50:     0x7f47a7770cb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8a3384b00ecc209a
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  51:     0x7f47a7770cb5 - std::sys::unix::thread::Thread::new::thread_start::h3b89517cd155e7bf
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7f47a750244b - <unknown>
  53:     0x7f47a7585e40 - <unknown>
  54:                0x0 - <unknown>
c/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  56:     0x7f47a7770cb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8a3384b00ecc209a
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  57:     0x7f47a7770cb5 - std::sys::unix::thread::Thread::new::thread_start::h3b89517cd155e7bf
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys/unix/thread.rs:108:17
  58:     0x7f47a750244b - <unknown>
  59:     0x7f47a7585e40 - <unknown>
  60:                0x0 - <unknown>
 std[637671632e4d6836]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1efc0c1d63102c92]::util::run_in_thread_pool_with_globals<rustc_interface[1efc0c1d63102c92]::interface::run_compiler<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}>::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>
  68:     0x7f47aa1d26ee - <<std[637671632e4d6836]::thread::Builder>::spawn_unchecked_<rustc_interface[1efc0c1d63102c92]::util::run_in_thread_pool_with_globals<rustc_interface[1efc0c1d63102c92]::interface::run_compiler<core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>, rustc_driver_impl[73dfa8b3f1700d5b]::run_compiler::{closure#1}>::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[222739805fe3bed]::result::Result<(), rustc_span[9451958236a7e67c]::ErrorGuaranteed>>::{closure#1} as core[222739805fe3bed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  69:     0x7f47a7770cb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33d48cbded0f44d0
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  70:     0x7f47a7770cb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8a3384b00ecc209a
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/alloc/src/boxed.rs:2007:9
  71:     0x7f47a7770cb5 - std::sys::unix::thread::Thread::new::thread_start::h3b89517cd155e7bf
                               at /rustc/0646a5d1aa3745cb448db247f6fa432890a1812b/library/std/src/sys/unix/thread.rs:108:17
  72:     0x7f47a750244b - <unknown>
  73:     0x7f47a7585e40 - <unknown>
  74:                0x0 - <unknown>


rustc version: 1.73.0-nightly (0646a5d1a 2023-07-20)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `connect::{closure#0}`
#1 [mir_borrowck] borrow-checking `connect`
#2 [type_of] computing type of `connect::{opaque#0}`
#3 [check_mod_item_types] checking item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack


query stack during panic:
#0 [mir_borrowck] borrow-checking `connect`
#1 [type_of] computing type of `connect::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack


query stack during panic:
#0 [mir_borrowck] borrow-checking `connect`
#1 [type_of] computing type of `connect::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack

@matthiaskrgr
Copy link
Member Author

The original finding was from one of the files in https://github.com/matthiaskrgr/glacier2/tree/master/fixed 😅

@estebank
Copy link
Contributor

estebank commented Jul 20, 2023

That actually makes sense to me, I'll have to dig into it, but it sounds like it might be straightforward to fix.

Edit: wait, re your last comment, did this new machinery regressed a previously fixed ICE, or is it an expected ICE that the new machinery didn't handle gracefully?

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jul 20, 2023

nono, not that I know, the fixed directory is just full of files where plain rustc file.rs does not crash anymore, but icemaker can use spicy -Z flags or different executables like rustdoc, rustfmt, clippy, miri, kani, cranelift that cause ices even in the fixed directory :)

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 20, 2023
@estebank
Copy link
Contributor

This happens exclusively for DelayedBugPanic because they have their own machinery to print their own (more useful) backtrace. Looking into it.

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Jul 25, 2023

Hm, I also just noticed, when for example clippy panics (you can force that with a delay_span_bug attr), we also generate an empty file :/



rustc version: 1.73.0-nightly (31395ec38 2023-07-24)
platform: x86_64-unknown-linux-gnu% 

repro

// this simulates clippy panicking due to ICE
// if we do not catch this in our CI; raise an error

#![feature(rustc_attrs)]
#[rustc_error(delay_span_bug_from_inside_query)]
fn main() {}

@estebank
Copy link
Contributor

I believe that #114128 fixes the situation for all cases detected, both delayed span bugs and panic during panic.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 28, 2023
…davidtwco

When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist

Fix rust-lang#113881.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 28, 2023
…davidtwco

When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist

Fix rust-lang#113881.
@bors bors closed this as completed in 656213c Jul 29, 2023
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. D-diagnostic-infra Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself. 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.

4 participants