{"record":{"id":"41c83a6f4794c522","repo":"apache/hadoop","slug":"no-other-node-is-currently-active","errorCode":null,"errorMessage":"No other node is currently active.","messagePattern":"No other node is currently active\\.","errorType":"exception","errorClass":"ServiceFailedException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java","lineNumber":678,"sourceCode":"   * 5) Allow the old active to rejoin the election, so a future\n   * failback is possible.\n   */\n  private void doGracefulFailover()\n      throws ServiceFailedException, IOException, InterruptedException {\n    int timeout = FailoverController.getGracefulFenceTimeout(conf) * 2;\n    Preconditions.checkArgument(timeout >= 0, \"timeout should be non-negative.\");\n    \n    // Phase 1: pre-flight checks\n    checkEligibleForFailover();\n    \n    // Phase 2: determine old/current active node. Check that we're not\n    // ourselves active, etc.\n    HAServiceTarget oldActive = getCurrentActive();\n    if (oldActive == null) {\n      // No node is currently active. So, if we aren't already\n      // active ourselves by means of a normal election, then there's\n      // probably something preventing us from becoming active.\n      throw new ServiceFailedException(\n          \"No other node is currently active.\");\n    }\n    \n    if (oldActive.getAddress().equals(localTarget.getAddress())) {\n      LOG.info(\"Local node \" + localTarget + \" is already active. \" +\n          \"No need to failover. Returning success.\");\n      return;\n    }\n\n    // Phase 2b: get the other nodes\n    List<HAServiceTarget> otherNodes = getAllOtherNodes();\n    List<ZKFCProtocol> otherZkfcs = new ArrayList<ZKFCProtocol>(otherNodes.size());\n\n    // Phase 3: ask the other nodes to yield from the election.\n    long st = System.nanoTime();\n    HAServiceTarget activeNode = null;\n    for (HAServiceTarget remote : otherNodes) {\n      // same location, same node - may not always be == equality","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java#L660-L696","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check actual states first: 'hdfs haadmin -getAllServiceState' — if no node is active, graceful failover is the wrong tool.","Repair/restart the standby's ZKFC and let the normal election make it active, or manually 'hdfs haadmin -transitionToActive <nnId>' on a healthy node.","If ZK sessions are flapping, check ZooKeeper health and tune ha.zookeeper.session-timeout-ms / ZK tickTime.","Investigate why the active znode disappeared (previous active's ZKFC logs)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before graceful failover, confirm someone is actually active\nHAServiceTarget active = getCurrentActive(); // via ZK /hadoop-ha/<ns> lock inspection\nif (active == null) {\n  // skip graceful failover; use election or manual transitionToActive instead\n}","typeGuard":null,"tryCatchPattern":"try {\n  haadmin.failover(fromNn, toNn); // graceful\n} catch (ServiceFailedException e) {\n  if (\"No other node is currently active.\".equals(e.getMessage())) {\n    // check hdfs haadmin -getAllServiceState; if no active, recover via\n    // election (repair ZKFCs) or manual -transitionToActive on a healthy NN\n  }\n}","preventionTips":["Check service states before issuing graceful failover instead of assuming an active exists.","Monitor ZK session expiry events on active ZKFCs — they predict 'no active' windows.","After formatZK or ZK incidents, verify an active exists before scripted failovers run."],"tags":["hadoop","high-availability","graceful-failover","zookeeper","election"],"backgroundTag":"high-availability-failover-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}