← Back to Pull requests

Fix MultiThreadedExecutor busy wait on busy callback groups #3395

Closed
unknown closed this pull request without merging on Nov 11, 2026 13:54 UTC
View on GitHub
unknown unknown commented on Oct 30, 2026 13:19 UTC
Author

Description

Fixes the remaining flake in TestBusyWaiting seen in nightly_linux_repeated:

test_executors_busy_waiting.cpp:109
Expected: (waitable->get_is_ready_call_count()) < (10u * this->waitable->get_count()), actual: 2507 vs 20

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_from becomes false. 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 set entities_need_rebuild_.

For level-triggered entities (a subscription with queued data, or TestWaitable, which re-triggers its guard condition in add_to_wait_set() while trigger_count_ > 0), the wait returns immediately and B spins until A finishes and the interrupt_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. In test_spin that 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(), set entities_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-execution interrupt_guard_condition_ trigger in MultiThreadedExecutor::run() adds it back once it is released. The extra rebuild only happens in the case that would otherwise busy wait

Diff: 248 lines (+186 / -62) across 3 files Reviewer: skyegalaxy Review duration: 17314m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 38.9% (MEDIUM) · Higher = larger blast radius
38.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.4% · Safe to merge
15.4%
Repository