rust-lang / rust-lang/rust

Flaky failure in query feeding on the parallel compiler: `caller raced calls to put()`

Open
#162,316 3 comments 0 reactions 1 assignee View on GitHub

@aerooneqq is already working on this.

Since Sep 8, 2026.

A-parallel-compiler C-bug I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Observed in a CI failure here: https://github.com/rust-lang/rust/pull/162105#issuecomment-5543359309

thread 'rustc' (525478) panicked at compiler/rustc_data_structures/src/vec_cache.rs:179:23:
caller raced calls to put()
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: rustc_middle::query::calls::query_feed::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>>
   3: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
   4: <<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis::hir_ty_lowering::GenericArgsLowerer>::provided_kind
   5: rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args::<<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt>
   6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path
   7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_poly_trait_ref
   8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_bounds::<&[rustc_hir::hir::GenericBound]>
   9: rustc_hir_analysis::collect::clauses_of::implied_clauses_with_filter
  10: rustc_hir_analysis::collect::clauses_of::explicit_implied_clauses_of
      [... omitted 1 frame ...]
  11: rustc_hir_analysis::check::check::check_item_type
  12: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 1 frame ...]
  13: rustc_middle::query::calls::query_ensure_result::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, ()>
  14: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::par_slice<&rustc_hir::hir::ItemId, rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}::{closure#0}::{closure#0}>
  15: <rustc_thread_pool::scope::ScopeBase>::execute_job_closure::<<rustc_thread_pool::scope::Scope>::spawn<rustc_data_structures::sync::parallel::par_slice<&rustc_hir::hir::ItemId, rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}::{closure#0}>::{closure#0}::{closure#0}, ()>
  16: <rustc_thread_pool::job::HeapJob<<rustc_thread_pool::scope::Scope>::spawn<rustc_data_structures::sync::parallel::par_slice<&rustc_hir::hir::ItemId, rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}::{closure#0}>::{closure#0}> as rustc_thread_pool::job::Job>::execute
  17: <rustc_thread_pool::registry::WorkerThread>::wait_or_steal_until_cold
  18: <rustc_thread_pool::registry::ThreadBuilder>::run
  19: rustc_span::set_session_globals_then::<(), rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#5}::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Normally it's OK to feed the same query twice as long as both values are the same. However, from looking at query_feed there might be a race condition when two query calls try to feed the same query at the same time, see that the cache is empty, and then both try to fill the cache entry without further coordination.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.