{"record":{"id":"0c26ac55095dcb2d","repo":"aeron-io/aeron","slug":"interrupted","errorCode":null,"errorMessage":"interrupted","messagePattern":"interrupted","errorType":"exception","errorClass":"AgentTerminationException","httpStatus":null,"severity":"warning","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java","lineNumber":3101,"sourceCode":"            leadershipTermId,\n            termBaseLogPosition,\n            commitPosition,\n            appendedPosition,\n            activeMembers,\n            clusterMemberByIdMap,\n            thisMember,\n            consensusPublisher,\n            ctx,\n            this);\n\n        election.doWork(clusterClock.timeNanos());\n    }\n\n    private static void checkInterruptStatus()\n    {\n        if (Thread.currentThread().isInterrupted())\n        {\n            throw new AgentTerminationException(\"interrupted\");\n        }\n    }\n\n    private void snapshotOnServiceAck(final long logPosition, final long timestamp, final ServiceAck[] serviceAcks)\n    {\n        if (isSnapshotSetComplete(serviceAcks))\n        {\n            try\n            {\n                takeSnapshot(timestamp, logPosition, serviceAcks);\n            }\n            catch (final RuntimeException ex)\n            {\n                ctx.countedErrorHandler().onError(new ClusterException(\"failed to take snapshot\", ex));\n                if (ex instanceof AgentTerminationException ||\n                    ex instanceof ArchiveException ae && ArchiveException.STORAGE_SPACE == ae.errorCode())\n                {\n                    unexpectedTermination(ex.getMessage());","sourceCodeStart":3083,"sourceCodeEnd":3119,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java#L3083-L3119","documentation":"checkInterruptStatus throws AgentTerminationException when the current thread's interrupt flag is set. Long-running cluster operations (elections, catchup, snapshots) check this regularly so the agent shuts down promptly on interruption instead of continuing in a degraded state.","triggerScenarios":"Thrown whenever the agent thread is interrupted, e.g. during idle() calls or blocking waits, after another thread called Thread.interrupt() on the agent.","commonSituations":"Container/executor shutdown calling shutdownNow(); JVM shutdown hooks interrupting agents; test frameworks cancelling long-running cluster agents; timeouts implemented via interrupt.","solutions":["Find what interrupted the thread (executor shutdown, shutdown hook) and confirm it is intentional","If shutting down, let the container close cleanly; this error is expected during shutdown","Avoid using interrupt-based timeouts against cluster agents; use AgentRunner close instead","Restart the agent after the shutdown completes if the interruption was accidental"],"exampleFix":"// before: interrupting the agent to stop it\nagentRunner.agent().interrupt();\n\n// after: close the runner gracefully\nagentRunner.close();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (AgentTerminationException e)\n{\n    if (\"interrupted\".equals(e.getMessage()))\n    {\n        log.info(\"agent interrupted, shutting down cleanly\");\n        Thread.interrupted(); // clear flag before optional re-launch\n        return;\n    }\n    throw e;\n}","preventionTips":["Stop agents with AgentRunner.close(), not Thread.interrupt()","Expect this error during executor shutdownNow and treat it as normal","Avoid interrupt-based timeouts on cluster agent threads","Register shutdown hooks that close containers before interrupting threads"],"tags":["aeron","thread","interrupt","shutdown"],"backgroundTag":"thread-interrupted","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}