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
- Retry the query after the server finishes restarting.
- Wait for the coordinator to come back healthy (health check) before resubmitting.
- During planned shutdowns, drain/cancel active queries first.
- 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
- Use health-checked load balancing across coordinators
- Drain queries before planned restarts
- Apply bounded exponential backoff for transient server errors
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
- NOT_SUPPORTED
- Interrupted while preprocessing query
- StatementClient thread was interrupted
- SERVER_SHUTTING_DOWN
- NOT_FOUND
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/5d97c2f18df88c4a.
Report an issue: GitHub.