{"record":{"id":"f26503d6c9240d95","repo":"aeron-io/aeron","slug":"failed-to-send-keep-alive-after-archive-connect","errorCode":null,"errorMessage":"failed to send keep alive after archive connect","messagePattern":"failed to send keep alive after archive connect","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":4195,"sourceCode":"                            state(State.SEND_ARCHIVE_ID_REQUEST);\n                        }\n                    }\n                }\n            }\n        }\n\n        private void state(final State newState)\n        {\n//            System.out.println(state + \" -> \" + newState);\n            state = newState;\n        }\n\n        private AeronArchive transitionToDone(final long archiveId)\n        {\n            if (!archiveProxy.keepAlive(controlSessionId, NULL_VALUE))\n            {\n                archiveProxy.closeSession(controlSessionId);\n                throw new ArchiveException(\"failed to send keep alive after archive connect\");\n            }\n\n            final AeronArchive aeronArchive = new AeronArchive(\n                ctx, controlResponsePoller, archiveProxy, controlSessionId, archiveId);\n\n            state(State.DONE);\n            return aeronArchive;\n        }\n    }\n\n    static Exception quietClose(final Exception previousException, final AutoCloseable closeable)\n    {\n        Exception resultException = previousException;\n        if (null != closeable)\n        {\n            try\n            {\n                closeable.close();","sourceCodeStart":4177,"sourceCodeEnd":4213,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L4177-L4213","documentation":"Thrown by the AeronArchive connect state machine after the control session is established: the client could not offer a keep-alive message on the archive control request publication. Without a keep-alive the archive would eventually time out and close the new session, so the connect fails fast. This is an I/O/publication failure, not a logical error.","triggerScenarios":"Calling AeronArchive.connect() (or asyncConnect completion) when the control request Publication offer fails because the publication is CLOSED or NOT_CONNECTED — e.g. the archive rejected the connection or the control channel died between session establishment and keep-alive.","commonSituations":"Archive process restarted mid-connect; control-response channel reached but control-request publication lost connection (wrong channel, multicast/TTL issues); network partition during connect; archive shut down by operator or crashed.","solutions":["Retry AeronArchive.connect() after confirming the archive is up and reachable","Verify controlRequestChannel/controlRequestStreamId in AeronArchive.Context point at the running archive's control endpoint","Check archive logs for session rejection or shutdown around the connect time","Check network connectivity and that the control-request publication is not closed by a driver error"],"exampleFix":"// before\nAeronArchive archive = AeronArchive.connect(); // throws if transport hiccups\n// after\nAeronArchive archive;\ntry {\n    archive = AeronArchive.connect();\n} catch (ArchiveException e) {\n    // backoff and retry connect\n    archive = retryConnect(3);\n}","handlingStrategy":"retry","validationCode":"// check archive reachability before connect\nif (!isPortOpen(archiveHost, archiveControlPort)) throw new IllegalStateException(\"archive control endpoint unreachable\");","typeGuard":null,"tryCatchPattern":"try { archive = AeronArchive.connect(ctx); } catch (ArchiveException e) { backoffAndRetry(e); }","preventionTips":["Health-check the archive control endpoint before connecting","Keep messageTimeoutNs generous relative to network latency","Monitor Aeron driver error log for publication closures"],"tags":["aeron-archive","connect","publication-offer","keepalive"],"backgroundTag":"api-request-failed","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"}