apache/hadoop · error · ServiceFailedException

No other node is currently active.

Error message

No other node is currently active.

What it means

gracefulFailover() Phase 2 throws ServiceFailedException('No other node is currently active.') when getCurrentActive() returns null — no node currently holds the active znode under /hadoop-ha/<ns> and the local node is not active either. There is no old active to ask to cede, so graceful failover cannot proceed.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java:678

   * 5) Allow the old active to rejoin the election, so a future
   * failback is possible.
   */
  private void doGracefulFailover()
      throws ServiceFailedException, IOException, InterruptedException {
    int timeout = FailoverController.getGracefulFenceTimeout(conf) * 2;
    Preconditions.checkArgument(timeout >= 0, "timeout should be non-negative.");
    
    // Phase 1: pre-flight checks
    checkEligibleForFailover();
    
    // Phase 2: determine old/current active node. Check that we're not
    // ourselves active, etc.
    HAServiceTarget oldActive = getCurrentActive();
    if (oldActive == null) {
      // No node is currently active. So, if we aren't already
      // active ourselves by means of a normal election, then there's
      // probably something preventing us from becoming active.
      throw new ServiceFailedException(
          "No other node is currently active.");
    }
    
    if (oldActive.getAddress().equals(localTarget.getAddress())) {
      LOG.info("Local node " + localTarget + " is already active. " +
          "No need to failover. Returning success.");
      return;
    }

    // Phase 2b: get the other nodes
    List<HAServiceTarget> otherNodes = getAllOtherNodes();
    List<ZKFCProtocol> otherZkfcs = new ArrayList<ZKFCProtocol>(otherNodes.size());

    // Phase 3: ask the other nodes to yield from the election.
    long st = System.nanoTime();
    HAServiceTarget activeNode = null;
    for (HAServiceTarget remote : otherNodes) {
      // same location, same node - may not always be == equality

View on GitHub (pinned to 2add963021)

Solutions

  1. Check actual states first: 'hdfs haadmin -getAllServiceState' — if no node is active, graceful failover is the wrong tool.
  2. Repair/restart the standby's ZKFC and let the normal election make it active, or manually 'hdfs haadmin -transitionToActive <nnId>' on a healthy node.
  3. If ZK sessions are flapping, check ZooKeeper health and tune ha.zookeeper.session-timeout-ms / ZK tickTime.
  4. Investigate why the active znode disappeared (previous active's ZKFC logs).
Defensive patterns

Strategy: try-catch

Validate before calling

// Before graceful failover, confirm someone is actually active
HAServiceTarget active = getCurrentActive(); // via ZK /hadoop-ha/<ns> lock inspection
if (active == null) {
  // skip graceful failover; use election or manual transitionToActive instead
}

Try / catch

try {
  haadmin.failover(fromNn, toNn); // graceful
} catch (ServiceFailedException e) {
  if ("No other node is currently active.".equals(e.getMessage())) {
    // check hdfs haadmin -getAllServiceState; if no active, recover via
    // election (repair ZKFCs) or manual -transitionToActive on a healthy NN
  }
}

Prevention

When it happens

Trigger: Initiating graceful failover when the previous active's ZKFC session expired (ephemeral active node gone), the active died without a standby taking over yet, or the ZK parent znode was reformatted/deleted so no active lock exists.

Common situations: Active node crashed before the operator ran failover; ZooKeeper session timeout flapping removed the ephemeral node; formatZK ran while nodes were up; both ZKFCs down and operator tries haadmin failover.

Related errors


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