{"record":{"id":"730810ae0d60937c","repo":"prestodb/presto","slug":"server-shutting-down","errorCode":"SERVER_SHUTTING_DOWN","errorMessage":"Server is shutting down","messagePattern":"Server is shutting down","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java","lineNumber":1122,"sourceCode":"\n    private static class ErrorCodedExecutor\n            implements Executor\n    {\n        private final Executor delegate;\n\n        private ErrorCodedExecutor(Executor delegate)\n        {\n            this.delegate = requireNonNull(delegate, \"delegate is null\");\n        }\n\n        @Override\n        public void execute(Runnable command)\n        {\n            try {\n                delegate.execute(command);\n            }\n            catch (RejectedExecutionException e) {\n                throw new PrestoException(SERVER_SHUTTING_DOWN, \"Server is shutting down\", e);\n            }\n        }\n    }\n}\n","sourceCodeStart":1104,"sourceCodeEnd":1127,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java#L1104-L1127","documentation":"Thrown by HiveSplitManager's RejectedExecutionHandler when a task is submitted to the split-loading executor after the Presto server has begun shutting down and its thread pools reject new work. It signals the query cannot proceed because the coordinator/worker is going away.","triggerScenarios":"Split loading tasks submitted via executor.execute() while the server is stopping; RejectedExecutionException from the underlying delegate executor is wrapped into SERVER_SHUTTING_DOWN.","commonSituations":"Deploying a new version or restarting Presto while queries run; server crash or SIGTERM during query execution; systemctl stop / graceful shutdown racing active queries.","solutions":["Wait for the server restart to complete and re-run the query.","Enable graceful shutdown and drain active queries before stopping (e.g., shutdown timeout so queries finish).","Use a coordinator with query retry/ha proxy so clients resubmit during rolling restarts."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { runQuery(sql); } catch (PrestoException e) {\n    if (SERVER_SHUTTING_DOWN.toErrorCode().getCode() == e.getErrorCode().getCode()) {\n        retryWithBackoff(sql); // resubmit after server restart completes\n    } else { throw e; }\n}","preventionTips":["Use graceful shutdown with drain so queries finish before workers stop","Retry queries automatically during rolling deploys","Schedule heavy queries away from deployment windows"],"tags":["shutdown","server","lifecycle"],"backgroundTag":"server-shutting-down","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}