← Back to Pull requests

fix: complete tasks killed while HRTR waits for the worker to report them #20890

Open
unknown opened this pull request with 244 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 12, 2026 16:44 UTC
Author

Follow-up to #20773 and #20867.

Description

After the Overlord sends a task to a MiddleManager or Indexer, HttpRemoteTaskRunner waits up to druid.indexer.runner.taskAssignmentTimeout (5 minutes by default) for the worker to report it. It also waits when the assign request fails and the Overlord cannot tell whether the task arrived. The runner ignored a kill during this wait until the timeout: the task kept counting as pending, so autoscaling could treat it as demand, and the timeout then raised a "Task assignment timed out" alert for a task that was already gone.

Fix

shutdown() now wakes the waiting thread, which marks the killed task FAILED right away. The worker stays reserved until it reports the task or the timeout passes, because it may hold the task without the Overlord knowing, and workers accept tasks beyond their capacity. If the worker reports the task, the Overlord tells it to stop, as it already does for completed tasks. A killed task no longer raises the timeout alert.

Tests

The new testShutdownTaskWhileWaitingForWorkerToReportIt covers a worker that never reports the killed task, reports it RUNNING, or reports it FAILED. All three cases fail without the fix. testShutdownTaskBeingAssigned(true) drops two assertions that depended on whether the kill or the worker's report arrived first.

Release note

A task killed while the Overlord waits for a worker to confirm its assignment no longer stays pending for up to 5 minutes or raises a "Task assignment timed out" alert.

<hr>

This PR has:

  • been self-reviewed.

  • - [x] using the concurrency checklist
  • a release note entry in the PR description.

  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • Diff: 244 lines (+183 / -61) across 3 files Reviewer: amaechler Review duration: 25982m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 244 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.329
    Real PR Conversation Timeline
    1 comments
    "Review active on #20890"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 20.7% · Safe to merge
    20.7%
    Repository