{"record":{"id":"ff85a483909db950","repo":"aeron-io/aeron","slug":"failed-to-send-stop-recording-request","errorCode":null,"errorMessage":"failed to send stop recording request","messagePattern":"failed to send stop recording request","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":859,"sourceCode":"     * a recording on a channel without a sessionId parameter will not stop the recording of any sessionId specific\n     * recordings that use the same channel and streamId.\n     *\n     * @param channel  to stop recording for.\n     * @param streamId to stop recording for.\n     */\n    public void stopRecording(final String channel, final int streamId)\n    {\n        lock.lock();\n        try\n        {\n            ensureConnected();\n            ensureNotReentrant();\n\n            lastCorrelationId = aeron.nextCorrelationId();\n\n            if (!archiveProxy.stopRecording(channel, streamId, lastCorrelationId, controlSessionId))\n            {\n                throw new ArchiveException(\"failed to send stop recording request\");\n            }\n\n            pollForResponse(lastCorrelationId);\n        }\n        finally\n        {\n            lock.unlock();\n        }\n    }\n\n    /**\n     * Try to stop a recording for a channel and stream pairing.\n     * <p>\n     * Channels that include sessionId parameters are considered different from channels without sessionIds. Stopping\n     * a recording on a channel without a sessionId parameter will not stop the recording of any sessionId specific\n     * recordings that use the same channel and streamId.\n     *\n     * @param channel  to stop recording for.","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L841-L877","documentation":"stopRecording sends a StopRecordingRequest for the given channel/streamId and polls for the archive's acknowledgment. If ArchiveProxy.stopRecording returns false the request could not be offered on the control publication, and ArchiveException is thrown since the stop never reached the archive.","triggerScenarios":"Calling AeronArchive.stopRecording(channel, streamId) when the control-request publication cannot accept the message: control session disconnected, back-pressure, or buffer full.","commonSituations":"Application shutdown attempting to stop recordings after the archive connection dropped; archive under load; control channel congestion during burst of stop requests.","solutions":["Retry stopRecording with back-off once the control session is reconnected","If stopping during shutdown, ensure the archive connection is still alive or accept the recording continues and stop it after reconnect","Catch ArchiveException and fall back to tryStopRecording or reconnect-then-stop"],"exampleFix":"// before\narchive.stopRecording(channel, streamId); // throws if request cannot be sent\n// after\ntry {\n    archive.stopRecording(channel, streamId);\n} catch (ArchiveException ex) {\n    archive = AeronArchive.connect(ctx);\n    archive.stopRecording(channel, streamId);\n}","handlingStrategy":"retry","validationCode":"if (!archiveProxy.controlPublication().isConnected()) {\n    throw new IllegalStateException(\"archive control publication not connected\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    archive.stopRecording(channel, streamId);\n} catch (ArchiveException ex) {\n    if (ex.getMessage().contains(\"failed to send\")) { retryWithBackoff(); }\n}","preventionTips":["Use tryStopRecording when an unknown subscription is an expected outcome","Ensure the archive connection is alive during shutdown sequences","Bound retries and reconcile recording state later"],"tags":["aeron-archive","ipc","backpressure"],"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-15T23:17:13.987Z"}