fix: Stop HttpRemoteTaskRunner from launching tasks killed while pending #20740
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 297 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.341
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #20740"
general
weight: 0.35
amaechler
Fixes #20298.
Description
A task killed while waiting for a task slot could still be launched by
HttpRemoteTaskRunner.TaskQueue.shutdown()marks the task FAILED, releases its locks and callsTaskRunner.shutdown(), butHttpRemoteTaskRunner.shutdown()ignored PENDING and PENDING_WORKER_ASSIGN work items. The pending task executor then assigned the task to the next free worker, where it ran until the next storage sync dropped the queue entry and the Overlord shut it down again. It also kept showing up ingetPendingTasks().shutdown()now removes a PENDING work item frompendingTaskIdsunderstatusLock, then completes it with a FAILED status outside the lock, astaskComplete(...)requires. The item stays intasksas COMPLETE, like a task a worker reported finished, and the nextshutdown()call fromTaskQueueremoves it.TaskQueue's callback for the FAILED future returns early because the entry is already complete.A PENDING_WORKER_ASSIGN item is only removed from
pendingTaskIds, so it cannot be assigned again. Its state belongs to the thread that is assigning it, which may revert it to PENDING outsidestatusLock; completing it fromshutdown()would race with that revert. If the worker starts the task, the nextshutdown()call fromTaskQueuefinds it RUNNING and kills it on the worker. If the assignment fails, the item goes back to PENDING and the nextshutdown()call completes it.This is a regression from #13558, which stopped
shutdown()from removing every work item fromtasksso that running tasks keep their completion callbacks.Release note
Fixed an issue where a task killed while waiting for a task slot could still be launched on a Middle Manager or Indexer when the Overlord uses the
httpRemotetask runner (the default).<hr>
##### Key changed/added classes in this PR
*
HttpRemoteTaskRunner<hr>
This PR has:
- [x] using the concurrency checklist (Remove this item if the PR doesn't have any relation to concurrency.)