aeron-io/aeron · warning · AeronException

unexpected interrupt

Error message

unexpected interrupt

What it means

CommonContext.sleep is a helper that pauses the calling thread; if Thread.sleep is interrupted, the interrupt flag is restored and an AeronException('unexpected interrupt') is thrown with the InterruptedException as cause, because nothing in driver-await logic expects interruption.

Solutions

  1. Avoid interrupting threads that are connecting to Aeron; let the connect attempt finish or use a shorter driver timeout
  2. Catch AeronException at shutdown and treat it as an aborted connect
  3. If interruption is expected in your design, wrap connect in code that handles AeronException cause InterruptedException

Example fix

// before
executor.shutdownNow(); // interrupts thread inside Aeron.connect()

// after
CompletableFuture<Aeron> connecting = CompletableFuture.supplyAsync(() -> Aeron.connect(ctx));
connecting.cancel(false); // let it finish instead of interrupting, or join with timeout first
Defensive patterns

Strategy: try-catch

Try / catch

try { Aeron aeron = Aeron.connect(ctx); } catch (AeronException e) { if (e.getMessage().equals("unexpected interrupt") && e.getCause() instanceof InterruptedException) { Thread.currentThread().interrupt(); /* treat as cancelled connect */ } else { throw e; } }

Prevention

When it happens

Trigger: Shutting down or interrupting the thread that is calling Aeron.connect() / driver-awaiting code while it is inside a sleep between CnC polling attempts.

Common situations: Application shutdown ExecutorService.shutdownNow interrupting a connecting thread; timeouts that cancel/interrupt connect attempts; test frameworks interrupting threads between tests.

Related errors


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

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/CommonContext.java:1488

        {
            return loggingErrorHandler;
        }
        else
        {
            return new ErrorHandlerWrapper(loggingErrorHandler, userErrorHandler);
        }
    }

    static void sleep(final long durationMs)
    {
        try
        {
            Thread.sleep(durationMs);
        }
        catch (final InterruptedException ex)
        {
            Thread.currentThread().interrupt();
            throw new AeronException("unexpected interrupt", ex);
        }
    }

    private static String cncFileErrorMessage(final File file, final Exception ex)
    {
        return "cannot open CnC file: " + file.getAbsolutePath() + " reason=" + ex;
    }

    private static final class ErrorHandlerWrapper implements ErrorHandler, AutoCloseable
    {
        private final LoggingErrorHandler loggingErrorHandler;
        private final ErrorHandler userErrorHandler;

        private ErrorHandlerWrapper(final LoggingErrorHandler loggingErrorHandler, final ErrorHandler userErrorHandler)
        {
            this.loggingErrorHandler = loggingErrorHandler;
            this.userErrorHandler = userErrorHandler;
        }

View on GitHub (pinned to 6d60124e15)