Skip to content

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

Description

@Zalathar

Observed in a CI failure here: #162105 (comment)

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.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 5, 2026
  2. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Sep 5, 2026
  3. petrochenkov commented on Sep 5, 2026

    @petrochenkov
    Contributor

    This happened when compiling tests/ui/traits/alias/self-in-const-generics.rs (CI logs disappear with time).

  4. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 5, 2026
  5. aerooneqq commented on Sep 8, 2026

    @aerooneqq
    Contributor

    Reproduced locally, simple reproducer: rustc ./tests/ui/traits/alias/self-in-const-generics.rs -Znext-solver=coherence -Zthreads=4, should reproduce within 100_000 launches. I want to try to fix it.
    @rustbot claim

  6. JonathanBrouwer commented on Sep 8, 2026

    @JonathanBrouwer
    Member

    One more occurence here: #162474 (comment)
    I'll add a //@ ignore-parallel-frontend triage to the test for now

  7. added 2 commits that reference this issue on Sep 8, 2026
  8. added a commit that references this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-parallel-compilerArea: parallel compilerC-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.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions