apache/druid · error · IllegalStateException

Some locks for task[%s] are already revoked

Error message

Some locks for task[%s] are already revoked

What it means

SegmentNukeAction.perform() deletes segments from the metadata store only while holding valid task locks. Its CriticalAction.onInvalidLocks callback throws this ISE when any of the task's locks have already been revoked, preventing destructive deletes (segment nuking) under stale authority. The task should fail and reacquire locks.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentNukeAction.java:86

    return new TypeReference<>() {};
  }

  @Override
  public Integer perform(Task task, TaskActionToolbox toolbox)
  {
    TaskLocks.checkLockCoversSegments(task, toolbox.getTaskLockbox(), segments);

    final int numDeletedSegments;
    try {
      final Set<Interval> intervals = segments.stream().map(DataSegment::getInterval).collect(Collectors.toSet());
      numDeletedSegments = toolbox.getTaskLockbox().doInCriticalSection(
          task,
          intervals,
          CriticalAction.<Integer>builder().onValidLocks(
              () -> toolbox.getIndexerMetadataStorageCoordinator().deleteSegments(segments)
          ).onInvalidLocks(
              () -> {
                throw new ISE("Some locks for task[%s] are already revoked", task.getId());
              }
          ).build()
      );

      log.info(
          "Deleted [%d] segments from metadata store out of requested[%d],"
          + " across [%d] intervals[%s], for task[%s] of datasource[%s].",
          numDeletedSegments, segments.size(),
          intervals.size(), intervals,
          task.getId(), task.getDataSource()
      );
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }

    // Emit metrics
    final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Retry the kill task after the competing task finishes.
  2. Ensure no overlapping compaction/overwrite tasks target the same intervals while nuking.
  3. Verify lock priority settings (druid.indexer.task.priority etc.) so only intended tasks preempt.
  4. Serialize kill operations via your orchestration instead of running concurrent kills.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify no overlapping higher-priority tasks and valid locks before nuking:
// if (toolbox.getTaskLockbox().isLockRevokedOrMissing(task)) abort kill;

Try / catch

try { rows = nukeAction.perform(task, toolbox); } catch (ISE e) { if (e.getMessage().contains("already revoked")) { /* retry kill after competitor finishes */ } else throw e; }

Prevention

When it happens

Trigger: A kill/nuke task attempts SEGMENT_NUKE after its interval locks were preempted by a higher-priority task, or between lock acquisition and execution the locks were revoked.

Common situations: Kill tasks racing with compaction or newer overwrite tasks for the same interval; concurrent kill tasks on the same data; priority misconfiguration allowing silent preemption.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/a379d505b8b9f1c8. Report an issue: GitHub.