apache/druid · error · RuntimeException

Interrupted while waiting for queryable server initial…

Error message

Interrupted while waiting for queryable server initial successful sync.

What it means

serverInventoryInitialized() blocks waiting until all queryable servers report at least one successful sync (or serverSyncWaitTimeout elapses), sleeping in 5s intervals. If the sleeping thread is interrupted, it rethrows as a RuntimeException with this message — callers cannot get a reliable answer about inventory readiness.

Solutions

  1. Restore the interrupt flag and exit the readiness wait gracefully if you own the calling code
  2. Ensure shutdown ordering stops the inventory view before interrupting its waiting threads
  3. Check why servers are not syncing (network, discovery) if interrupts coincide with long waits
  4. Increase serverSyncWaitTimeout so waits finish before shutdown interrupts occur

Example fix

// before
view.serverInventoryInitialized(); // RE on interrupt
// after
try {
  view.serverInventoryInitialized();
} catch (RuntimeException e) {
  Thread.currentThread().interrupt();
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// check readiness without blocking, if exposed, or wait within timeout budget
long deadline = System.currentTimeMillis() + timeoutMs;

Try / catch

try { view.serverInventoryInitialized(); } catch (RuntimeException e) { Thread.currentThread().interrupt(); throw e; }

Prevention

When it happens

Trigger: Thread waiting in the poll loop receives Thread.interrupt() — typically during JVM/server shutdown or task cancellation while uninitialized servers remain.

Common situations: Druid broker shutdown while some historical servers never synced; overloading serverSyncWaitTimeout so a shutdown interrupts a long wait; test frameworks interrupting timed-out threads.

Related errors


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

Appendix: source

Thrown at server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java:392

   */
  private void serverInventoryInitialized()
  {
    long start = System.currentTimeMillis();
    long serverSyncWaitTimeout = config.getServerTimeout() + 2 * ChangeRequestHttpSyncer.HTTP_TIMEOUT_EXTRA_MS;

    List<DruidServerHolder> uninitializedServers = new ArrayList<>();
    for (DruidServerHolder server : servers.values()) {
      if (!server.isSyncedSuccessfullyAtleastOnce()) {
        uninitializedServers.add(server);
      }
    }

    while (!uninitializedServers.isEmpty() && ((System.currentTimeMillis() - start) < serverSyncWaitTimeout)) {
      try {
        Thread.sleep(5000);
      }
      catch (InterruptedException ex) {
        throw new RE(ex, "Interrupted while waiting for queryable server initial successful sync.");
      }

      log.info("Waiting for [%d] servers to sync successfully.", uninitializedServers.size());
      uninitializedServers.removeIf(
          serverHolder -> serverHolder.isSyncedSuccessfullyAtleastOnce()
                          || serverHolder.isStopped()
      );
    }

    if (uninitializedServers.isEmpty()) {
      log.info("All servers have been synced successfully at least once.");
    } else {
      for (DruidServerHolder server : uninitializedServers) {
        log.warn(
            "Server[%s] might not yet be synced successfully. We will continue to retry that in the background.",
            server.druidServer.getName()
        );
      }

View on GitHub (pinned to 9b90983fd2)