apache/druid · warning · RuntimeException

Interrupted waiting for jetty shutdown.

Error message

Interrupted waiting for jetty shutdown.

What it means

When the Druid node shuts down, a lifecycle stop hook stops the Jetty server and waits for the stop to complete. If that wait is interrupted (the stopping thread receives an interrupt), the module re-interrupts the thread and throws this ResourceInterruptedException to signal shutdown did not complete cleanly.

Solutions

  1. Usually benign during process exit: verify the node terminated and ignore if only occurring at shutdown.
  2. If recurring, check what is interrupting the shutdown thread (watchdog, test harness) and fix that component.
  3. Ensure Lifecycle.stop() is called from a thread that is not being interrupted during teardown.

Example fix

// before
lifecycle.stop();  // thread may be interrupted here
// after
try {
  lifecycle.stop();
} catch (ResourceInterruptedException e) {
  LOG.warn(e, "Jetty shutdown interrupted; continuing teardown");
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  lifecycle.stop();
} catch (ResourceInterruptedException e) {
  if (e.getMessage().contains("Interrupted waiting for jetty shutdown")) {
  LOG.warn(e, "Jetty shutdown was interrupted; server may not have stopped cleanly");
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling stop() on the Jetty lifecycle while another thread interrupts the stopping thread, e.g. during fast process shutdown, Lifecycle.stop() racing with JVM exit, or a watchdog thread interrupting a hung shutdown.

Common situations: kill -TERM / systemd stop racing with other lifecycle shutdown; test frameworks interrupting threads between tests; a coordinator dropping leadership triggering stop while the process is being torn down.

Related errors


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

Appendix: source

Thrown at server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java:459

          }

          @Override
          public void stop()
          {
            try {
              final long unannounceDelay = config.getUnannouncePropagationDelay().toStandardDuration().getMillis();
              if (unannounceDelay > 0) {
                log.info("Sleeping %s ms for unannouncement to propagate.", unannounceDelay);
                Thread.sleep(unannounceDelay);
              } else {
                log.debug("Skipping unannounce wait.");
              }
              log.debug("Stopping Jetty Server...");
              server.stop();
            }
            catch (InterruptedException e) {
              Thread.currentThread().interrupt();
              throw new RE(e, "Interrupted waiting for jetty shutdown.");
            }
            catch (Exception e) {
              log.warn(e, "Unable to stop Jetty server.");
            }
          }
        },
        Lifecycle.Stage.SERVER
    );

    if (!config.isShowDetailedJettyErrors()) {
      server.setErrorHandler(new ErrorHandler()
      {
        @Override
        public boolean handle(
            Request baseRequest,
            Response response,
            Callback callback
        ) throws Exception

View on GitHub (pinned to 9b90983fd2)