aeron-io/aeron · error · ArchiveException

failed to send stop all replays request

Error message

failed to send stop all replays request

What it means

stopAllReplays sends a STOP_ALL_REPLAYS request for a recording. If ArchiveProxy.stopAllReplays returns false — the control-request publication is not connected or the offer fails — no request reached the archive and this ArchiveException is thrown.

Solutions

  1. Verify the archive process is running and the control channel endpoint is reachable.
  2. Reconnect the session (AeronArchive.connect) and retry stopAllReplays.
  3. Retry with exponential backoff if backpressure is likely transient.
  4. Log recordingId and correlationId (lastCorrelationId field) for post-mortem when retries fail.

Example fix

// before
archive.stopAllReplays(recordingId);

// after
try {
    archive.stopAllReplays(recordingId);
} catch (ArchiveException e) {
    archive.close();
    archive = AeronArchive.connect(archiveCtx);
    archive.stopAllReplays(recordingId);
}
Defensive patterns

Strategy: retry

Validate before calling

if (recordingId <= 0) throw new IllegalArgumentException("invalid recordingId");
boolean connected = archive != null && !archive.isClosed() && archive.state() == AeronArchive.State.CONNECTED;

Type guard

boolean canStopAll(AeronArchive a) { return a != null && !a.isClosed() && a.state() == AeronArchive.State.CONNECTED; }

Try / catch

try {
    archive.stopAllReplays(recordingId);
} catch (ArchiveException e) {
    archive = AeronArchive.connect(archiveCtx);
    retryWithBackoff(() -> archive.stopAllReplays(recordingId));
}

Prevention

When it happens

Trigger: Calling stopAllReplays(recordingId) during an archive outage, network partition, control-stream backpressure, or after the client's control session publication has closed (e.g. archive restart invalidated the session).

Common situations: Failover/cleanup logic that stops all replays while the archive is mid-restart; batch jobs issuing many stop requests that backpressure the single control stream; stale AeronArchive handles kept across redeploys.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/77ad0339fdd385ad. Report an issue: GitHub.

Appendix: source

Thrown at aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java:1210

    /**
     * Stop all replay sessions for a given recording id or all replays in general.
     *
     * @param recordingId to stop replay for or {@link Aeron#NULL_VALUE} for all replays.
     */
    public void stopAllReplays(final long recordingId)
    {
        lock.lock();
        try
        {
            ensureConnected();
            ensureNotReentrant();

            lastCorrelationId = aeron.nextCorrelationId();

            if (!archiveProxy.stopAllReplays(recordingId, lastCorrelationId, controlSessionId))
            {
                throw new ArchiveException("failed to send stop all replays request");
            }

            pollForResponse(lastCorrelationId);
        }
        finally
        {
            lock.unlock();
        }
    }

    /**
     * Replay a length in bytes of a recording from a position and for convenience create a {@link Subscription}
     * to receive the replay. If the position is {@link #NULL_POSITION} then the stream will be replayed from the start.
     *
     * @param recordingId    to be replayed.
     * @param position       from which the replay should begin or {@link #NULL_POSITION} if from the start.
     * @param length         of the stream to be replayed or {@link AeronArchive#REPLAY_ALL_AND_FOLLOW} to follow a live
     *                       recording. Use {@link AeronArchive#REPLAY_ALL_AND_STOP} to read up the available limit

View on GitHub (pinned to 6d60124e15)