apache/hadoop · error · RuntimeException

caught interrupted

Error message

caught interrupted

What it means

The deprecated DFSClient.renewDelegationToken() renews a delegation token; renewal executes through UserGroupInformation.doAs, which can throw InterruptedException (e.g. during relogin). The deprecated wrapper flattens that into a bare RuntimeException('caught interrupted'), discarding the typed contract and the thread's interrupt status.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java:780

      return token;
    }
  }

  /**
   * Renew a delegation token
   * @param token the token to renew
   * @return the new expiration time
   * @throws IOException
   * @deprecated Use Token.renew instead.
   */
  @Deprecated
  public long renewDelegationToken(Token<DelegationTokenIdentifier> token)
      throws IOException {
    LOG.info("Renewing {}", DelegationTokenIdentifier.stringifyToken(token));
    try {
      return token.renew(conf);
    } catch (InterruptedException ie) {
      throw new RuntimeException("caught interrupted", ie);
    } catch (RemoteException re) {
      throw re.unwrapRemoteException(InvalidToken.class,
          AccessControlException.class);
    }
  }

  /**
   * Cancel a delegation token
   * @param token the token to cancel
   * @throws IOException
   * @deprecated Use Token.cancel instead.
   */
  @Deprecated
  public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
      throws IOException {
    LOG.info("Cancelling {}", DelegationTokenIdentifier.stringifyToken(token));
    try {
      token.cancel(conf);

View on GitHub (pinned to 2add963021)

Solutions

  1. Migrate to the supported API: token.renew(conf) (Token.renew), which declares InterruptedException so you can handle it properly.
  2. If the old API must stay, catch RuntimeException, test re.getCause() instanceof InterruptedException, restore the interrupt flag with Thread.currentThread().interrupt(), and decide to abort or reschedule renewal.
  3. Run renewal on a dedicated scheduler thread that is never cancelled with shutdownNow() mid-RPC.

Example fix

// before
client.renewDelegationToken(token);
// RuntimeException: caught interrupted

// after
try {
  long nextExpiry = token.renew(conf);
} catch (InterruptedException ie) {
  Thread.currentThread().interrupt();
  // abort this renewal attempt or reschedule it
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  client.renewDelegationToken(token);
} catch (RuntimeException re) {
  if (re.getCause() instanceof InterruptedException) {
    Thread.currentThread().interrupt(); // preserve the interrupt, abort or reschedule
  } else { throw re; }
}

Prevention

When it happens

Trigger: Invoking the deprecated renewDelegationToken(token) from a thread that is already interrupted or gets interrupted mid-RPC: executor shutdownNow(), MR/Spark task cancellation, or a concurrent kerberos relogin inside doAs.

Common situations: Legacy MR job-token renewal code paths on older client versions; token-renewal daemons sharing threads with cancellable work; tests that interrupt worker pools while renewal is in flight.

Related errors


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