apache/hadoop · warning · IOException
Print network topology failed. {}
Error message
Print network topology failed. {} What it means
RouterNetworkTopologyServlet serves the /topology endpoint on the router's HTTP (admin) server, printing the network topology of all datanodes. Any Throwable raised while streaming the topology (printTopology) is stringified, reported to the client as HTTP 410 Gone, and rethrown as an IOException from the servlet.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterNetworkTopologyServlet.java:76
try {
datanodeReport = syncReturn(DatanodeInfo[].class);
} catch (Exception e) {
throw new IOException(e);
}
} else {
datanodeReport = router.getRpcServer().getDatanodeReport(
HdfsConstants.DatanodeReportType.ALL);
}
List<Node> datanodeInfos = Arrays.asList(datanodeReport);
try (PrintStream out = new PrintStream(
response.getOutputStream(), false, "UTF-8")) {
printTopology(out, datanodeInfos, format);
} catch (Throwable t) {
String errMsg = "Print network topology failed. "
+ StringUtils.stringifyException(t);
response.sendError(HttpServletResponse.SC_GONE, errMsg);
throw new IOException(errMsg);
} finally {
response.getOutputStream().close();
}
}
}View on GitHub (pinned to 2add963021)
Solutions
- Read the stringified exception in the 410 response body - it contains the original stack trace
- Retry the request without the format parameter (or with a supported one) to rule out bad input
- Check the router log for the same stack and verify getDatanodeReport works via hdfs dfsadmin -fs router:// -report
- If the resolver layout is broken (NPE on node parent/rack), fix the resolver/state store configuration and restart the router
Defensive patterns
Strategy: try-catch
Validate before calling
// Health-check the report before scraping the servlet
DatanodeInfo[] report = routerRpcServer.getDatanodeReport(DatanodeReportType.ALL);
if (report == null) { // defensive: servlet dereferences Arrays.asList(report) earlier
LOG.warn("Datanode report unavailable; /topology may fail");
} Try / catch
try {
ResponseEntity<String> resp = restTemplate.getForEntity(routerTopologyUrl, String.class);
if (resp.getStatusCode() == HttpStatus.GONE) { // servlet sends 410 with stringified cause
LOG.warn("Topology print failed: {}", resp.getBody());
// retry later; inspect router log for the original stack
}
} catch (RestClientException e) {
// connection-level failure, distinct from the servlet's 410
} Prevention
- Monitor the router's /topology endpoint with alerting on 410 responses and log the body (it carries the stack)
- Pass only supported format parameters; test format handling before automating scrapes
- Keep the router RPC server and resolvers healthy - most topology print failures trace to bad resolver state
When it happens
Trigger: A GET request to the router's /topology endpoint (optionally with a format parameter) where printTopology fails: an unsupported format string, an exception while walking the datanode report (e.g. null/bad Node data), or an output-stream failure after the response started.
Common situations: Operators scraping the router UI/topology page for rack layout; a malformed format query parameter; router whose datanode report is in an unexpected state (e.g. resolver returned empty/None layout) causing a NPE inside topology printing.
Related errors
- No mount point for %s
- Rename of {} to {} is not allowed, no eligible destination i
- Rename of {} to {} is not allowed. The remote location shoul
- Rename of {} to {} failed.
- Permission denied rename {}({}) to {}({}) Reason={}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f1351f1d6360b5a0.
Report an issue: GitHub.