prestodb/presto · warning · PrestoException

SERVER_SHUTTING_DOWN

SERVER_SHUTTING_DOWN

Error message

Server is shutting down

What it means

The query state machine's executor rejected a state-change callback because the executor service was shut down — i.e. the Presto server is shutting down. It is surfaced as SERVER_SHUTTING_DOWN so clients know the failure is server-side and transient.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/StateMachine.java:316

    public interface StateChangeListener<T>
    {
        void stateChanged(T newState);
    }

    @Override
    public String toString()
    {
        return get().toString();
    }

    private void safeExecute(Runnable command)
    {
        try {
            executor.execute(command);
        }
        catch (RejectedExecutionException e) {
            if ((executor instanceof ExecutorService) && ((ExecutorService) executor).isShutdown()) {
                throw new PrestoException(SERVER_SHUTTING_DOWN, "Server is shutting down", e);
            }
            throw e;
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Retry the query after the server finishes restarting.
  2. Wait for the coordinator to come back healthy (health check) before resubmitting.
  3. During planned shutdowns, drain/cancel active queries first.
  4. Use a load balancer to route clients away from shutting-down coordinators.

Example fix

// before
query = client.execute(sql); // throws SERVER_SHUTTING_DOWN during restart
// after
retryOn(SERVER_SHUTTING_DOWN, backoff, () -> client.execute(sql));
Defensive patterns

Strategy: retry

Validate before calling

// check server health before submitting queries
GET /v1/status -> 200 means coordinator is up

Try / catch

// catch PrestoException with errorCode SERVER_SHUTTING_DOWN; back off and retry after the coordinator restarts (bounded retries)

Prevention

When it happens

Trigger: safeExecute() calls executor.execute(command) during a query state transition and receives RejectedExecutionException with executor.isShutdown() == true — queries transitioning while the coordinator is stopping.

Common situations: Queries running/coordinating during a coordinator restart, rolling deployments, or graceful shutdown killing the executor while queries are still active.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/5d97c2f18df88c4a. Report an issue: GitHub.