apache/hadoop · error
EINTERNAL
EINTERNAL
Error message
hdfsGetHosts(path=%s, start=%"PRId64", length=%"PRId64"): BlockLocation#getHosts returned NULL
What it means
hdfsGetHosts walks the file's BlockLocation[] and calls BlockLocation#getHosts over JNI for each block. Java normally returns an array (possibly empty), so a null return signals a broken implementation or bad JVM state; libhdfs reports EINTERNAL with the path and the start/length range in the message.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c:3786
if (jthr || !jFileBlock) {
ret = printExceptionAndFree(env, jthr, PRINT_EXC_ALL,
"hdfsGetHosts(path=%s, start=%"PRId64", length=%"PRId64"):"
"GetObjectArrayElement(%d)", path, start, length, i);
goto done;
}
jthr = invokeMethod(env, &jVal, INSTANCE, jFileBlock,
JC_BLOCK_LOCATION, "getHosts",
"()[Ljava/lang/String;");
if (jthr) {
ret = printExceptionAndFree(env, jthr, PRINT_EXC_ALL,
"hdfsGetHosts(path=%s, start=%"PRId64", length=%"PRId64"):"
"BlockLocation#getHosts", path, start, length);
goto done;
}
jFileBlockHosts = jVal.l;
if (!jFileBlockHosts) {
fprintf(stderr,
"hdfsGetHosts(path=%s, start=%"PRId64", length=%"PRId64"):"
"BlockLocation#getHosts returned NULL", path, start, length);
ret = EINTERNAL;
goto done;
}
//Figure out no of hosts in jFileBlockHosts, and allocate the memory
jNumBlockHosts = (*env)->GetArrayLength(env, jFileBlockHosts);
blockHosts[i] = calloc(jNumBlockHosts + 1, sizeof(char*));
if (!blockHosts[i]) {
ret = ENOMEM;
goto done;
}
//Now parse each hostname
for (j = 0; j < jNumBlockHosts; ++j) {
jHost = (*env)->GetObjectArrayElement(env, jFileBlockHosts, j);
jthr = (*env)->ExceptionOccurred(env);
if (jthr || !jHost) {View on GitHub (pinned to 2add963021)
Solutions
- Align the libhdfs native library version with the hadoop jars of the same distribution
- Generate CLASSPATH with `hadoop classpath` from the matching installation
- Treat EINTERNAL from this call as non-retryable and report the file and range from the message
Defensive patterns
Strategy: fallback
Try / catch
if (hdfsGetHosts(fs, path, start, length, &hosts) == -1) {
/* EINTERNAL: JVM returned null; treat as unavailable, do not retry the same call */
hosts = NULL; /* proceed without locality info */
} Prevention
- Keep libhdfs.so and hadoop jars from the same distribution
- Generate CLASSPATH with `hadoop classpath` from the matching install
- Design locality-aware callers to degrade gracefully when host info is unavailable
When it happens
Trigger: Version mismatch between the native libhdfs and the hadoop-hdfs jars on CLASSPATH; custom BlockLocation implementations; JVM state corrupted by earlier pending exceptions.
Common situations: Client machines with stale Hadoop jars; data-locality probes (HBase-style region placement) in mixed-version clusters; shaded Hadoop classes inside embedding frameworks.
Related errors
- EIO
- could not find method %s from class %s with signature %s
- JNI_GetCreatedJavaVMs failed with error: %d
- Cannot getLocatedBlocks through a symlink to a non-Distribut
- NativeIO is not available.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/cb255f0aac4bbaf9.
Report an issue: GitHub.