{"record":{"id":"7659ad158c50bee2","repo":"apache/cassandra","slug":"can-not-replay-during-shutdown","errorCode":null,"errorMessage":"Can not replay during shutdown","messagePattern":"Can not replay during shutdown","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/tcm/RemoteProcessor.java","lineNumber":229,"sourceCode":"    public ClusterMetadata fetchLogAndWait(Epoch waitFor, Retry retryPolicy)\n    {\n        // Synchonous, non-debounced call if we are waiting for the highest epoch (without knowing/caring what it is).\n        // Should be used sparingly.\n        if (waitFor == null)\n            return fetchLogAndWait(new CandidateIterator(candidates(true), false), log);\n\n        Future<ClusterMetadata> cmFuture = null;\n        try\n        {\n            Supplier<Future<ClusterMetadata>> fetchFunction = () -> fetchLogAndWaitInternal(new CandidateIterator(candidates(true), false),\n                                                                                            log);\n\n            cmFuture = EpochAwareDebounce.instance.getAsync(fetchFunction, waitFor);\n            return cmFuture.get(retryPolicy.remainingNanos(), TimeUnit.NANOSECONDS);\n        }\n        catch (InterruptedException e)\n        {\n            throw new RuntimeException(\"Can not replay during shutdown\", e);\n        }\n        catch (ExecutionException | TimeoutException e)\n        {\n            throw new RuntimeException(\"Could not replay\", e);\n        }\n    }\n\n    public static ClusterMetadata fetchLogAndWait(CandidateIterator candidateIterator, LocalLog log)\n    {\n        try\n        {\n            return fetchLogAndWaitInternal(candidateIterator, log).await().get();\n        }\n        catch (InterruptedException | ExecutionException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/RemoteProcessor.java#L211-L247","documentation":"RemoteProcessor.fetchLogAndWait wraps an InterruptedException from waiting on the metadata replay future and rethrows it as a RuntimeException with message 'Can not replay during shutdown'. When the JVM/node is shutting down, the thread waiting for EpochAwareDebounce's replay future is interrupted, and rather than silently returning stale metadata, the processor aborts with this error. It means TCM log replay was cancelled because the process is stopping.","triggerScenarios":"fetchLogAndWait's cmFuture.get(retryPolicy.remainingNanos(), NANOSECONDS) throws InterruptedException because the waiting thread was interrupted during node shutdown; shutdown hooks interrupt in-flight metadata replay.","commonSituations":"Nodetool stop / kill during a metadata read; a CMS leadership change or teardown interrupting replay; JVM shutdown while background TCM catch-up is still in flight.","solutions":["Nothing to fix if intentional shutdown: the error is expected during stop; ensure retries after shutdown are suppressed.","Check shutdown ordering so TCM clients stop before interrupting replay threads.","Retry node startup after a clean shutdown; replay will proceed normally.","If seen outside shutdown, find what is calling Thread.interrupt() on the replay thread (thread pools closed early, cancelled tasks)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ClusterMetadata cm = RemoteProcessor.fetchLogAndWait(candidates, log); }\ncatch (RuntimeException e) {\n    if (\"Can not replay during shutdown\".equals(e.getMessage())) {\n        // shutdown in progress: stop retrying, abort catch-up\n        return;\n    }\n    throw e;\n}","preventionTips":["Order shutdown so TCM clients terminate before executor interruption","Suppress background catch-up tasks when the node is shutting down","Check shutdown latch before scheduling metadata replay"],"tags":["tcm","shutdown","interrupt","metadata-replay"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}