apache/druid · error · IllegalStateException

Exception while waiting to extract distributions.

Error message

Exception while waiting to extract distributions.

What it means

waitToProcessPendingReports() blocks on a Phaser until all pending sub-task reports have been processed by an executor, then shuts the executor down. If the await is interrupted or otherwise throws, the exception is wrapped in a generic ISE.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionParallelIndexTaskRunner.java:253

  }

  private File getDistributionJsonFile(File intervalDir, String subTaskId)
  {
    return new File(intervalDir, subTaskId);
  }

  /**
   * Waits for distributions from pending reports (if any) to be extracted.
   */
  private void waitToProcessPendingReports()
  {
    log.info("Waiting to extract distributions from sub-task reports.");
    try {
      allReportsProcessedPhaser.arriveAndAwaitAdvance();
      executor.shutdownNow();
    }
    catch (Exception e) {
      throw new ISE(e, "Exception while waiting to extract distributions.");
    }
  }

  private File createDistributionsDir()
  {
    File taskTempDir = getToolbox().getConfig().getTaskTempDir(getTaskId());
    File distributionsDir = new File(taskTempDir, "dimension_distributions");
    try {
      FileUtils.mkdirp(distributionsDir);
      return distributionsDir;
    }
    catch (IOException e) {
      throw new ISE(e, "Could not create temp distribution directory.");
    }
  }

  private void cleanupDistributionsDir()
  {

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Look at the wrapped cause and earlier log lines from the report-processing runnable for the real failure.
  2. Retry the batch task; phaser/interruption failures are usually transient.
  3. If reproducible, check for executor/thread pool configuration issues on the indexing service worker.
Defensive patterns

Strategy: retry

Try / catch

catch (IllegalStateException e) { if (e.getMessage().contains("Exception while waiting to extract distributions")) { log.error("cause", e.getCause()); retryTask(); } else { throw e; } }

Prevention

When it happens

Trigger: A worker thread in the report-processing executor dies unexpectedly, or the awaiting thread is interrupted (task cancellation, supervisor shutdown) while allReportsProcessedPhaser.arriveAndAwaitAdvance() is in progress.

Common situations: Overlord/worker interruption during task kill; bugs in distribution extraction threads throwing before arriving at the phaser; JVM thread pool exhaustion on the Middle Manager.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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