aeron-io/aeron · error · ClusterException

publication is closed

Error message

publication is closed

What it means

checkResult detects that the snapshot publication's underlying publication was CLOSED (Publication.CLOSED returned from offer/tryClaim). Once closed, no further snapshot data can be published and the snapshot cannot complete, so the taker throws immediately.

Solutions

  1. Do not close the Aeron client or publication while snapshotting; complete or cancel the snapshot first
  2. Check service logs for the earlier error that caused the publication to close
  3. Re-run the snapshot after the container has cleanly restarted
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure the publication is still open before snapshotting
if (publication.isClosed()) { recreatePublication(); }

Try / catch

try { snapshotTaker.snapshot(...); } catch (ClusterException e) { abortSnapshotAndShutdownCleanly(); }

Prevention

When it happens

Trigger: checkResultAndIdle is called after offer/tryClaim returned Publication.CLOSED — the Publication object was closed, typically because the cluster container or client was being torn down mid-snapshot.

Common situations: Shutting down or aborting a clustered service while a snapshot is in flight, Aeron client close racing with SnapshotTaker, or an error elsewhere causing the publication to be closed by the client conductor.

Related errors


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

Appendix: source

Thrown at aeron-cluster/src/main/java/io/aeron/cluster/service/SnapshotTaker.java:191

        }
    }

    /**
     * Check the result of offering to a publication when writing a snapshot.
     *
     * @param position    of an offer or try claim to a publication.
     * @param publication on which the offer or try claim was attempted.
     */
    protected static void checkResult(final long position, final Publication publication)
    {
        if (Publication.NOT_CONNECTED == position)
        {
            throw new ClusterException("publication is not connected");
        }

        if (Publication.CLOSED == position)
        {
            throw new ClusterException("publication is closed");
        }

        if (Publication.MAX_POSITION_EXCEEDED == position)
        {
            throw new ClusterException("publication at max position: term-length=" + publication.termBufferLength());
        }
    }

    /**
     * Check the result of offering to a publication when writing a snapshot and then idle after invoking the client
     * agent if necessary.
     *
     * @param position of an offer or try claim to a publication.
     */
    protected void checkResultAndIdle(final long position)
    {
        checkResult(position, publication);
        checkInterruptStatus();

View on GitHub (pinned to 6d60124e15)