apache/cassandra · warning · RuntimeException
Unexpected interruption
Error message
Unexpected interruption
What it means
In StressAction's inner run loop, each worker thread waits on a 'start' CountDownLatch so all threads begin simultaneously. If the worker thread is interrupted while waiting on start.await(), the code rethrows as RuntimeException('Unexpected interruption', e). Stress threads are not expected to be interrupted during startup; this means the JVM/harness interrupted the thread abnormally (e.g. shutdown hook, external kill semantics, or a bug in the coordinating code).
Source
Thrown at tools/stress/src/org/apache/cassandra/stress/StressAction.java:254
final Consumer[] consumers = new Consumer[threadCount];
for (int i = 0; i < threadCount; i++)
{
consumers[i] = new Consumer(operations, isWarmup,
done, start, releaseConsumers, workManager, metrics, rateLimiter);
}
// starting worker threadCount
for (int i = 0; i < threadCount; i++)
consumers[i].start();
// wait for the lot of them to get their pants on
try
{
start.await();
}
catch (InterruptedException e)
{
throw new RuntimeException("Unexpected interruption", e);
}
// start counting from NOW!
if(rateLimiter != null)
{
rateLimiter.start();
}
// release the hounds!!!
releaseConsumers.countDown();
metrics.start();
if (durationUnits != null)
{
Uninterruptibles.sleepUninterruptibly(duration, durationUnits);
workManager.stop();
}
else if (opCount <= 0)
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Check who interrupts the worker (shutdown hooks, cancel paths) and ensure stress is not torn down during startup.
- Re-run the stress command and avoid killing the process during the first seconds of the run.
- If interruption is intentional (cancel), treat this RuntimeException as expected cancellation in the harness.
- Wrap the StressAction invocation with try/catch (RuntimeException) checking getCause() instanceof InterruptedException for graceful shutdown.
Example fix
// before
stressAction.run(); // process may die with 'Unexpected interruption'
// after
try {
stressAction.run();
} catch (RuntimeException e) {
if (!(e.getCause() instanceof InterruptedException)) throw e;
// expected during shutdown
} Defensive patterns
Strategy: try-catch
Validate before calling
// ensure no component interrupts the stress thread during coordinated start: // avoid calling stressThread.interrupt() before start.countDown() fires
Try / catch
try {
start.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // restore interrupt status
throw new RuntimeException("Unexpected interruption", e);
} Prevention
- Do not interrupt stress worker threads except during deliberate shutdown.
- Register shutdown hooks that let the coordinated start complete or cancel cleanly.
- Run stress in environments (CI agents, supervisors) that do not SIGINT processes mid-startup.
When it happens
Trigger: Thread interrupt delivered while a stress worker is blocked in start.await() before the coordinated start — e.g. JVM shutdown initiated, StressAction cancel/interrupt path racing with worker start, or a misconfigured pool shutting down workers.
Common situations: Ctrl-C or timeout killing the stress process just as threads start; a supervising harness calling interrupt on the stress thread pool; bug fixes/patches that interrupt workers during setup.
Related errors
- Queue is empty
- UnsupportedOperationException
- Maximum pool size has been changed while resizing
- Must be one of ${values}
- ${executor} has shut down
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/4bec4b100f7e7fc4.
Report an issue: GitHub.