apache/hadoop · error · IOException
Unable to retrieve InMemoryAliasMap for block pool id " + bl
Error message
Unable to retrieve InMemoryAliasMap for block pool id " + blockPoolID
What it means
InMemoryLevelDBAliasMapClient iterates its configured InMemoryAliasMapProtocol handles (RPC endpoints from dfs.provided.aliasmap.inmemory.* config) and returns the one whose getBlockPoolId() equals the requested bpid. If no handle matches — including the case where every getBlockPoolId() RPC threw IOException and was only logged as ERROR — this IOException is thrown. Note the swallowing loop: an unreachable alias map server looks identical to a wrong block pool id.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/InMemoryLevelDBAliasMapClient.java:173
private InMemoryAliasMapProtocol getAliasMap(String blockPoolID)
throws IOException {
if (blockPoolID == null) {
throw new IOException("Block pool id required to get aliasmap reader");
}
// if a block pool id has been supplied, and doesn't match the associated
// block pool ids, return null.
for (InMemoryAliasMapProtocol aliasMap : aliasMaps) {
try {
String aliasMapBlockPoolId = aliasMap.getBlockPoolId();
if (aliasMapBlockPoolId != null &&
aliasMapBlockPoolId.equals(blockPoolID)) {
return aliasMap;
}
} catch (IOException e) {
LOG.error("Exception in retrieving block pool id {}", e);
}
}
throw new IOException(
"Unable to retrieve InMemoryAliasMap for block pool id " + blockPoolID);
}
@Override
public Reader<FileRegion> getReader(Reader.Options opts, String blockPoolID)
throws IOException {
InMemoryAliasMapProtocol aliasMap = getAliasMap(blockPoolID);
LOG.info("Loading InMemoryAliasMapReader for block pool id {}",
blockPoolID);
return new LevelDbReader(aliasMap);
}
@Override
public Writer<FileRegion> getWriter(Writer.Options opts, String blockPoolID)
throws IOException {
InMemoryAliasMapProtocol aliasMap = getAliasMap(blockPoolID);
LOG.info("Loading InMemoryAliasMapWriter for block pool id {}",
blockPoolID);View on GitHub (pinned to 2add963021)
Solutions
- Check the ERROR log line 'Exception in retrieving block pool id' — if present the root cause is the RPC failure there, not the bpid
- Verify dfs.provided.aliasmap.inmemory.rpc-address/port point at the running NameNode-side LevelDB alias map service and network/kerberos allows the RPC
- Confirm the bpid matches that cluster (compare with the BP-… directory name in the DN's provided/data dirs)
- For federation, ensure an alias map endpoint is configured for each nameservice whose blocks the DN serves
Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight: at least one configured alias map must answer for this bpid
boolean found = false;
for (InMemoryAliasMapProtocol p : aliasMapEndpoints) {
try {
if (blockPoolID.equals(p.getBlockPoolId())) { found = true; break; }
} catch (IOException ignored) {
// endpoint down — surface it instead of silently skipping
}
}
if (!found) throw new IllegalStateException(
"No alias map serves block pool " + blockPoolID); Try / catch
try {
Reader<FileRegion> r = aliasMapClient.getReader(opts, blockPoolID);
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().contains("Unable to retrieve InMemoryAliasMap")) {
// check the companion ERROR log for RPC failures vs wrong bpid before retrying
}
throw e;
} Prevention
- Health-check alias map RPC endpoints as part of cluster validation
- In federated setups, keep a mapping of nameservice -> alias map address in config checks
When it happens
Trigger: The blockPoolID belongs to none of the configured remote alias maps, or the alias map RPC endpoints are down/unreachable so their getBlockPoolId() calls fail (see companion ERROR log 'Exception in retrieving block pool id').
Common situations: dfs.provided.aliasmap.inmemory.rpc-address pointing at a dead or wrong service; federation setups where the DN reads with another nameservice's bpid; LevelDB alias map server (in the NN process) not started.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Block pool id required to get aliasmap reader
- InMemoryAliasMap location is null
- Unable to create missing aliasmap location: {levelDBpath}
- Failed to fully delete compressed aliasmap {compressedAliasM
- Unable to create aliasmap snapshot directory {newLevelDBDir}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/0eb39b84045c93b3.
Report an issue: GitHub.