apache/hadoop · error · ServiceFailedException
Failed to become active. {}
Error message
Failed to become active. {} What it means
gracefulFailover() Phase 5: an ActiveAttemptRecord exists but succeeded=false, so the recorded failure status is propagated as ServiceFailedException('Failed to become active. <status>'). The local node did attempt transitionToActive and the attempt failed; attempt.status (captured by recordActiveAttempt) carries the underlying reason.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java:740
throw new ServiceFailedException("Unable to become active. " +
"Local node did not get an opportunity to do so from ZooKeeper, " +
"or the local node took too long to transition to active.");
}
// Phase 5. At this point, we made some attempt to become active. So we
// can tell the old active to rejoin if it wants. This allows a quick
// fail-back if we immediately crash.
for (ZKFCProtocol zkfc : otherZkfcs) {
zkfc.cedeActive(-1);
}
if (attempt.succeeded) {
LOG.info("Successfully became active. " + attempt.status);
} else {
// Propagate failure
String msg = "Failed to become active. " + attempt.status;
throw new ServiceFailedException(msg);
}
}
/**
* Ask the remote zkfc to cede its active status and wait for the specified
* timeout before attempting to claim leader status.
* @param remote node to ask
* @param timeout amount of time to cede
* @return the {@link ZKFCProtocol} used to talk to the ndoe
* @throws IOException
*/
private ZKFCProtocol cedeRemoteActive(HAServiceTarget remote, int timeout)
throws IOException {
LOG.info("Asking " + remote + " to cede its active state for "
+ timeout + "ms");
ZKFCProtocol oldZkfc = remote.getZKFCProxy(conf, timeout);
oldZkfc.cedeActive(timeout);
return oldZkfc;View on GitHub (pinned to 2add963021)
Solutions
- Read attempt.status in the exception message together with the local NameNode log — it contains the transition failure reason.
- Fix the transition blocker (typically QJM/JournalNode availability or local storage).
- Retry graceful failover after repair; the old active has already been told to rejoin (cedeActive(-1)) so both nodes are back in the election.
Defensive patterns
Strategy: try-catch
Validate before calling
// Before failover: confirm the target can become active in principle — // JournalNodes reachable, storage writable (same pre-flight as 1033). // hdfs haadmin -checkHealth <nnId> plus JN port probes from the target host.
Try / catch
try {
zkfc.gracefulFailover();
} catch (ServiceFailedException e) {
if (e.getMessage().startsWith("Failed to become active.")) {
String status = e.getMessage().substring("Failed to become active.".length());
// status is the recorded ActiveAttemptRecord — the NN's own failure text;
// fix that (usually QJM), then retry; old active already rejoined election
}
} Prevention
- Treat any failed transitionToActive in NN logs as a blocker to clear before the next failover window.
- Keep JournalNode health monitored; it is the dominant root cause surfaced by this error.
- Dry-run failovers in staging after upgrades to catch transition regressions before production.
When it happens
Trigger: becomeActive() on the local node failed: the local NameNode rejected transitionToActive (e.g. cannot write to the JournalNode quorum, storage/upgrade state refuses active), recorded as a failed ActiveAttemptRecord and surfaced after the old active was told to rejoin.
Common situations: JournalNodes unavailable or in a torn state; NN in the middle of an upgrade/rollback; shared edits dir errors; the same root causes as 'Couldn't transition to active' but reached via the graceful-failover path.
Related errors
- Couldn't transition to active
- Unable to fence {}
- No other node is currently active.
- Unable to become active. Service became unhealthy while tryi
- Unable to become active. Local node did not get an opportuni
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/3db7db943ae3508f.
Report an issue: GitHub.