{"record":{"id":"3b8318ebe21cae8d","repo":"apache/cassandra","slug":"failed-to-submit-background-compaction-task","errorCode":null,"errorMessage":"Failed to submit background compaction task","messagePattern":"Failed to submit background compaction task","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/compaction/CompactionManager.java","lineNumber":483,"sourceCode":"                task.execute(active);\n            }\n            catch (Throwable t)\n            {\n                addAsyncError(t);\n            }\n            finally\n            {\n                if (toComplete.decrementAndGet() == 0)\n                    complete(true, asyncErrors.get());\n            }\n        }\n\n        private void rejectTask(AbstractCompactionTask task, AtomicInteger toComplete)\n        {\n            try\n            {\n                task.rejected();\n                throw new RuntimeException(\"Failed to submit background compaction task\");\n            }\n            catch (Throwable t) // make sure we catch exceptions thrown by task.rejected() as well\n            {\n                addAsyncError(t);\n            }\n            finally\n            {\n                if (toComplete.decrementAndGet() == 0)\n                    complete(false, asyncErrors.get());\n            }\n        }\n\n        private void complete(boolean submitNew, Throwable error)\n        {\n            compactingCF.remove(cfs);\n            if (error == null)\n            {\n                toSignalWhenDone.setSuccess(null);","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L465-L501","documentation":"When the compaction executor rejects a submitted background compaction task (executor saturated or shutting down), rejectTask calls task.rejected() and then throws this RuntimeException. The exception (including any thrown by rejected()) is recorded via addAsyncError rather than propagating to the caller.","triggerScenarios":"Background compaction submission to the executor's queue is rejected — typically because the node is shutting down, the executor was paused/disabled, or the task queue is full.","commonSituations":"Node shutdown or decommission racing with compaction submission, disabling autocompaction while tasks are in flight, severe executor backlog on overloaded nodes.","solutions":["Check whether the node is shutting down or autocompaction is disabled (nodetool statusautocompaction); re-enable and let compaction resume.","Inspect async error logs for the underlying rejection reason and address executor saturation (increase compaction throughput headroom).","Retry compaction after the node stabilizes; rejected tasks are normally resubmitted later."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before triggering compaction programmatically\nif (storageService.isStarting() || !compactionManager.isEnabled()) skipSubmission();","typeGuard":null,"tryCatchPattern":"try { scheduleCompaction(); } catch (RuntimeException e) { if (e.getMessage().equals(\"Failed to submit background compaction task\")) { retryAfterStabilization(); } }","preventionTips":["Avoid submitting compactions during shutdown/decommission","Ensure autocompaction is enabled before requesting tasks","Watch executor backlog metrics to avoid saturation"],"tags":["compaction","executor","shutdown"],"backgroundTag":"operation-not-supported","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}