Fix MultiThreadedExecutor busy wait on busy callback groups #3395
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 248 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3395"
general
weight: 0.35
skyegalaxy
Description
Fixes the remaining flake in
TestBusyWaitingseen innightly_linux_repeated:This is the same symptom as #3154. #3155 fixed a race in the test, but this one is a real busy wait in the
MultiThreadedExecutor.Root cause
When thread A takes an entity from a MutuallyExclusive callback group,
can_be_taken_frombecomesfalse. If the entity (or another one in the group) becomes ready again while A is still executing, the idle thread B:1. wakes from
wait_for_work(),2. skips the entity in
get_next_ready_executable()because its group is busy,3. calls
wait_for_work()again with the same collection, since nothing setentities_need_rebuild_.For level-triggered entities (a subscription with queued data, or
TestWaitable, which re-triggers its guard condition inadd_to_wait_set()whiletrigger_count_ > 0), the wait returns immediately and B spins until A finishes and theinterrupt_guard_condition_triggers a rebuild.build_entities_collection()already excludes groups that can't be taken from, but that only helps if a rebuild happens while the group is busy. Intest_spinthat depends on whether the notify waitable fired in the same wait that picked up the first execution, which is a race. The busy wait then lasts as long as the first callback, which waits on the main thread and is long on a loaded CI machine.Fix
In
Executor::get_next_ready_executable(), setentities_need_rebuild_whenever a ready entity is skipped because its callback group is gone or can't be taken from. The next wait then excludes the busy group, and the existing post-executioninterrupt_guard_condition_trigger inMultiThreadedExecutor::run()adds it back once it is released. The extra rebuild only happens in the case that would otherwise busy wait