Skip to content

deadlock detected when using -Zthreads=8 #117784

Closed
@MartinquaXD

Description

I just tried out the new parallelization feature of the compiler and it randomly panicked because a deadlock was detected.
I tried a couple of times and could not reproduce it unfortunately.

Meta

rustc --version --verbose:

cargo 1.75.0-nightly (7046d992f 2023-11-08)

Error output

thread '<unnamed>' panicked at compiler/rustc_query_system/src/query/job.rs:543:9:
deadlock detected

<Backtrace>

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -Z threads=8

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

query stack during panic:
end of query stack
deadlock handler panicked, aborting process
error: could not compile `bigdecimal` (lib)

Caused by:
  process didn't exit successfully: `/Users/martin/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name bigdecimal /Users/martin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigdecimal-0.3.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=128 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="serde"' -C metadata=36f9c58248b94912 -C extra-filename=-36f9c58248b94912 --out-dir /Users/martin/work/backend/side/target/debug/deps -L dependency=/Users/martin/work/backend/side/target/debug/deps --extern num_bigint=/Users/martin/work/backend/side/target/debug/deps/libnum_bigint-3d0a0c3120349810.rmeta --extern num_integer=/Users/martin/work/backend/side/target/debug/deps/libnum_integer-ed949aa408650e16.rmeta --extern num_traits=/Users/martin/work/backend/side/target/debug/deps/libnum_traits-a22352494166d956.rmeta --extern serde=/Users/martin/work/backend/side/target/debug/deps/libserde-2f69e42262cb5ef0.rmeta --cap-lints allow -Z threads=8` (signal: 6, SIGABRT: process abort signal)
warning: build failed, waiting for other jobs to finish...
Backtrace

stack backtrace:
   0:        0x100ee12b8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h052d4a6449303d0c
   1:        0x100f23268 - core::fmt::write::hd7376fa11f842969
   2:        0x100ed79ec - std::io::Write::write_fmt::h8962cd07816e935b
   3:        0x100ee10f4 - std::sys_common::backtrace::print::h97fb0a8a4077c481
   4:        0x100ee3af4 - std::panicking::default_hook::{{closure}}::h3b4672ac61ca5355
   5:        0x100ee383c - std::panicking::default_hook::h609e6a125a90b4e7
   6:        0x10a2eabb8 - <alloc[e142c9bf9c63cfc4]::boxed::Box<rustc_driver_impl[1a98898d3f3a38ed]::install_ice_hook::{closure#0}> as core[4e0a19b8f4e7b450]::ops::function::Fn<(&dyn for<'a, 'b> core[4e0a19b8f4e7b450]::ops::function::Fn<(&'a core[4e0a19b8f4e7b450]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[4e0a19b8f4e7b450]::marker::Send + core[4e0a19b8f4e7b450]::marker::Sync, &core[4e0a19b8f4e7b450]::panic::panic_info::PanicInfo)>>::call
   7:        0x100ee416c - std::panicking::rust_panic_with_hook::h9625542414b348eb
   8:        0x100ee3f10 - std::panicking::begin_panic_handler::{{closure}}::hb4fa343c314105dc
   9:        0x100ee1720 - std::sys_common::backtrace::__rust_end_short_backtrace::he263cec7b035e782
  10:        0x100ee3cd0 - _rust_begin_unwind
  11:        0x100f3d0b8 - core::panicking::panic_fmt::h624e311b541e9a0d
  12:        0x10b6fac6c - rustc_query_system[2c5cf56d08163fd7]::query::job::deadlock
  13:        0x10a2fba58 - std[f37625d93cba7df1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6fd153b9b61224af]::util::run_in_thread_pool_with_globals<rustc_interface[6fd153b9b61224af]::interface::run_compiler<(), rustc_driver_impl[1a98898d3f3a38ed]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#2}::{closure#1}, ()>
  14:        0x10a2cccfc - <<std[f37625d93cba7df1]::thread::Builder>::spawn_unchecked_<rustc_interface[6fd153b9b61224af]::util::run_in_thread_pool_with_globals<rustc_interface[6fd153b9b61224af]::interface::run_compiler<core[4e0a19b8f4e7b450]::result::Result<(), rustc_span[7d3d88934d9d268]::ErrorGuaranteed>, rustc_driver_impl[1a98898d3f3a38ed]::run_compiler::{closure#1}>::{closure#0}, core[4e0a19b8f4e7b450]::result::Result<(), rustc_span[7d3d88934d9d268]::ErrorGuaranteed>>::{closure#2}::{closure#1}, ()>::{closure#1} as core[4e0a19b8f4e7b450]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  15:        0x100eec368 - std::sys::unix::thread::Thread::new::thread_start::h6af77cae4d08b8df
  16:        0x18f69ffa8 - __pthread_joiner_wake

rustc-ice-2023-11-10T12_41_14-4307.txt

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-parallelWorking group: Parallelizing the compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions