aeron-io/aeron · error · AeronException

unexpected interrupt

Error message

unexpected interrupt

What it means

During AeronCluster.connect(), the blocking await helper rethrows checked exceptions and then checks the thread's interrupt flag. If the thread was interrupted while blocked, it throws AeronException('unexpected interrupt') because connect() does not support interruption and cannot complete safely with an unclear interruption state.

Solutions

  1. Avoid interrupting threads while AeronCluster.connect() is in flight; complete or cancel the connect before shutdown
  2. Run connect() on a thread not managed by the shutting-down executor, and close the cluster client via aeronCluster.close()
  3. If interruption is expected, catch AeronException around connect() and treat it as connect failure/cleanup

Example fix

// before
executor.shutdownNow(); // interrupts in-flight connect()
// after
clusterClient.close();          // cancel connect/close first
executor.shutdownNow();
Defensive patterns

Strategy: try-catch

Try / catch

try {
    AeronCluster cluster = AeronCluster.connect(ctx);
} catch (AeronException e) {
    if (Thread.currentThread().isInterrupted()) {
        Thread.currentThread().interrupt(); // restore flag, treat as cancelled connect
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: Thread.interrupt() (or executor shutdownNow) hitting the thread inside AeronCluster.connect()'s busy-spin wait loop.

Common situations: Application shutdown calling executorService.shutdownNow() while a client thread is connecting; timeout watchdogs interrupting slow connects; container lifecycle hooks interrupting initialization.

Related errors


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

Appendix: source

Thrown at aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java:2349

                    " ingressEndpoints=" + ctx.ingressEndpoints() +
                    " ingressPublication=" + ingressPublication +
                    " egress.isConnected=" + isConnected +
                    " responseChannel=" + egressChannel);

                for (final MemberIngress member : memberByIdMap.values())
                {
                    if (null != member.publicationException)
                    {
                        ex.addSuppressed(member.publicationException);
                    }
                }

                throw ex;
            }

            if (Thread.currentThread().isInterrupted())
            {
                throw new AeronException("unexpected interrupt");
            }
        }

        private void createEgressSubscription()
        {
            if (NULL_VALUE == egressRegistrationId)
            {
                egressRegistrationId = ctx.aeron().asyncAddSubscription(ctx.egressChannel(), ctx.egressStreamId());
            }

            try
            {
                egressSubscription = ctx.aeron().getSubscription(egressRegistrationId);
            }
            catch (final RegistrationException ex)
            {
                egressRegistrationId = NULL_VALUE;

View on GitHub (pinned to 6d60124e15)