apache/hadoop · error · InterruptedIOException

Call interrupted

Error message

Call interrupted

What it means

Thrown as an InterruptedIOException when the thread waiting for an Hadoop IPC response is interrupted while blocked in Call.rpcResponseFuture.get() inside Client.getRpcResponse. The client deliberately re-sets the thread's interrupt flag (Thread.currentThread().interrupt()) before throwing, so the interruption is not lost. It almost always means application shutdown, executor shutdownNow(), or a timeout framework cancelled the calling thread mid-RPC, not an RPC failure itself.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:1600

  }

  private void releaseAsyncCall() {
    asyncCallCounter.decrementAndGet();
  }

  @VisibleForTesting
  int getAsyncCallCount() {
    return asyncCallCounter.get();
  }

  /** @return the rpc response or, in case of timeout, null. */
  private Writable getRpcResponse(final Call call, final Connection connection)
      throws IOException {
    try {
      return call.rpcResponseFuture.get();
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      throw new InterruptedIOException("Call interrupted");
    } catch (ExecutionException e) {
      Throwable cause = e.getCause();
      if (cause instanceof IOException) {
        throw warpIOException((IOException) cause, connection);
      }
      throw new IllegalStateException(e);
    }
  }

  private IOException warpIOException(IOException ioe, Connection connection) {
    if (ioe instanceof RemoteException ||
        ioe instanceof SaslException) {
      ioe.fillInStackTrace();
      return ioe;
    } else { // local exception
      InetSocketAddress address = connection.getRemoteAddress();
      return NetUtils.wrapException(address.getHostName(),
          address.getPort(),

View on GitHub (pinned to 2add963021)

Solutions

  1. Catch InterruptedIOException and treat it as cancellation: restore the interrupt flag (it is already restored by the client) and stop the loop/task instead of retrying the RPC.
  2. If interrupts are unexpected, find who calls Thread.interrupt()/ExecutorService.shutdownNow() on the RPC thread (jstack shows the blocked worker) and stop that path before shutdown completes.
  3. Do not retry the same call on the same interrupted thread; move new calls to a non-interrupted thread if you must re-issue them.

Example fix

// before
try {
 FsStatus s = fs.getStatus(); // blocking RPC on an interruptible thread
} catch (IOException e) {
 LOG.error("RPC failed", e); // wrongly treats cancellation as failure and retries
}

// after
try {
 FsStatus s = fs.getStatus();
} catch (InterruptedIOException e) {
 // thread is already re-interrupted by the client; just stop working
 LOG.info("RPC cancelled by thread interruption; aborting task");
 return;
} catch (IOException e) {
 LOG.error("RPC failed", e);
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  T result = proxy.rpcCall(req);
} catch (InterruptedIOException e) {
  // interrupt flag was already restored by Client.getRpcResponse
  LOG.info("RPC cancelled by interruption; stopping task");
  return; // do not retry on this thread
}

Prevention

When it happens

Trigger: Calling a blocking RPC proxy method on a thread that gets interrupted: submit RPC work to an ExecutorService and call shutdownNow(); a watchdog/timeout thread interrupts the RPC caller; JVM shutdown hooks interrupt in-flight calls; test frameworks (JUnit timeout, Thread.interrupt() in @After) cancel the RPC thread.

Common situations: MapReduce/YARN task cancellation interrupting client threads, graceful application shutdown racing in-flight NameNode/ResourceManager calls, retry frameworks that interrupt the previous attempt, unit tests with aggressive thread cleanup.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/bb29200ac66506f2. Report an issue: GitHub.