{"record":{"id":"f8eb5c7e6685a454","repo":"aeron-io/aeron","slug":"ingress-publication-is-closed","errorCode":null,"errorMessage":"ingress publication is closed","messagePattern":"ingress publication is closed","errorType":"exception","errorClass":"ClusterException","httpStatus":null,"severity":"error","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java","lineNumber":569,"sourceCode":"\n            if (position > 0)\n            {\n                adminRequestEncoder\n                    .wrapAndApplyHeader(bufferClaim.buffer(), bufferClaim.offset(), messageHeaderEncoder)\n                    .leadershipTermId(leadershipTermId)\n                    .clusterSessionId(clusterSessionId)\n                    .correlationId(correlationId)\n                    .requestType(AdminRequestType.SNAPSHOT)\n                    .putPayload(ArrayUtil.EMPTY_BYTE_ARRAY, 0, 0);\n\n                bufferClaim.commit();\n\n                return true;\n            }\n\n            if (position == Publication.CLOSED)\n            {\n                throw new ClusterException(\"ingress publication is closed\");\n            }\n\n            if (position == Publication.MAX_POSITION_EXCEEDED)\n            {\n                throw new ClusterException(\"max position exceeded: term-length=\" + publication.termBufferLength());\n            }\n\n            if (--attempts <= 0)\n            {\n                break;\n            }\n\n            idleStrategy.idle();\n        }\n\n        return false;\n    }\n","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java#L551-L587","documentation":"sendAdminRequestToTakeASnapshot offers an admin request on the ingress publication and polls the returned position. When the offer result equals Publication.CLOSED the publication has been closed and cannot accept messages, so the library throws ClusterException instead of silently failing to send the snapshot request.","triggerScenarios":"Calling AeronCluster.sendAdminRequestToTakeASnapshot() after the cluster session or ingress publication was closed — e.g. the client was closed on another thread, the cluster rejected/closed the session, or onNewLeader re-establishment closed the old publication.","commonSituations":"Triggering snapshots from admin tooling while the client is concurrently shut down; calling snapshot APIs after cluster connection loss; race between a session-close notification and an admin request.","solutions":["Check AeronCluster.state()/connection liveness before issuing the admin request; reconnect with connect() if closed.","Catch ClusterException and re-establish the cluster session before retrying the snapshot request.","Synchronize client shutdown with code paths that send admin requests so they are not called concurrently with close().","Investigate why the publication closed — session termination by the cluster (e.g. auth rejection) or explicit close()."],"exampleFix":"// before\ncluster.sendAdminRequestToTakeASnapshot(); // throws if publication closed\n// after\nif (!cluster.isPublicationConnected()) { cluster.close(); cluster = AeronCluster.connect(ctx); }\ncluster.sendAdminRequestToTakeASnapshot();","handlingStrategy":"validation","validationCode":"if (!cluster.isPublicationConnected()) { cluster.close(); cluster = AeronCluster.connect(ctx.clone()); }","typeGuard":null,"tryCatchPattern":"try { cluster.sendAdminRequestToTakeASnapshot(); } catch (ClusterException e) { if (e.getMessage().contains(\"ingress publication is closed\")) { reconnectAndRetrySnapshot(); } }","preventionTips":["Check client session state before issuing admin requests.","Synchronize close() with admin request senders.","Treat session-close egress events as cancelling pending admin requests."],"tags":["cluster","ingress","closed-publication","admin-request"],"backgroundTag":"invalid-state-transition","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}