Skip to content

HttpRemoteTaskRunner leaves a task killed mid-assignment pending if the assignment fails #20773

Closed

Description

@amaechler

Affected Version

master since #20740 (63e3c24). Before #20740, the task could launch instead; see #20298.

Description

Follow-up to #20740. If TaskQueue kills a task while HttpRemoteTaskRunner is assigning it to a worker, and the assignment then fails, the task never launches but stays pending:

  • getPendingTasks() and getPendingTaskPayloads() still list it, so PendingTaskBasedWorkerProvisioningStrategy counts it as demand.
  • Its result future stays open.

This lasts until TaskQueue calls shutdown() again in the management pass after its next storage sync, 1 to 2 druid.indexer.queue.storageSyncRate periods (1 minute by default) later. That call completes the task as FAILED. The assignment fails this way only when the chosen worker drops out right after it is picked, so this is rare. HTTP errors don't cause it, because assignTask() returns true when unsure. If the assignment succeeds instead, the killed task runs on the worker until that same shutdown() call kills it.

The reason for this:

  1. For a PENDING_WORKER_ASSIGN work item, shutdown() only removes it from pendingTaskIds, because the assigning thread owns the item.
  2. When the worker turns out to be removed, lazy or blacklisted, or disabled, the assigning thread reverts the item to PENDING. Nothing records the kill, so the item is neither assigned again nor completed.

Activity

  1. akasakariko commented on Nov 8, 2026

    @akasakariko
    Contributor

    I'd like to work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions