apache/druid · error · IllegalStateException

can't stop

Error message

can't stop

What it means

Lifecycle guard in ConsulDruidNodeAnnouncer.stop(): the LifecycleStop hook detected via LifecycleLock that the announcer is not in a started state (never started, already stopped, or start still in progress), so a stop request is invalid. Usually indicates a lifecycle sequencing bug or a double stop; the code simply skips stopping.

Solutions

  1. Avoid duplicate stop() calls; ensure start() completed before stopping.
  2. Inspect logs for the earlier lifecycle failure that left the lock in this state.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java:110 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java:110

      long intervalMs = config.getService().getHealthCheckInterval().getMillis();
      healthCheckExecutor.scheduleAtFixedRate(
          this::updateHealthChecks,
          0L,
          intervalMs,
          TimeUnit.MILLISECONDS
      );
      lifecycleLock.started();
    }
    finally {
      lifecycleLock.exitStart();
    }
  }

  @LifecycleStop
  public void stop()
  {
    if (!lifecycleLock.canStop()) {
      throw new ISE("can't stop");
    }

    LOGGER.info("Stopping ConsulDruidNodeAnnouncer");

    healthCheckExecutor.shutdownNow();

    // Wait for health check to finish so we don't deregister while health check is in progress
    try {
      if (!healthCheckExecutor.awaitTermination(EXECUTOR_TERMINATION_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
        LOGGER.warn("Health check executor did not terminate in time");
      }
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      LOGGER.warn("Interrupted while waiting for health check termination");
    }

    for (String serviceId : announcedNodes.keySet()) {

View on GitHub (pinned to 9b90983fd2)