apache/hadoop · error

EIO

EIO

Error message

fuseConnectAsThreadUid: failed to open a libhdfs connection!  error %d.

What it means

Emitted by the fuse-dfs rmdir handler when fuseConnectAsThreadUid() cannot obtain a libhdfs connection for the calling UID; rmdir on the mount fails with EIO. The protected-path check (EACCES) and the later not-empty check (ENOTEMPTY from hdfsListDirectory) are separate outcomes; this message means the connection step itself failed before any HDFS call was made.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_impls_rmdir.c:49

  dfs_context *dfs = (dfs_context*)fuse_get_context()->private_data;
  int numEntries = 0;
  hdfsFileInfo *info = NULL;

  TRACE1("rmdir", path)

  assert(path);
  assert(dfs);
  assert('/' == *path);

  if (is_protected(path)) {
    ERROR("Trying to delete protected directory %s", path);
    ret = -EACCES;
    goto cleanup;
  }

  ret = fuseConnectAsThreadUid(&conn);
  if (ret) {
    fprintf(stderr, "fuseConnectAsThreadUid: failed to open a libhdfs "
            "connection!  error %d.\n", ret);
    ret = -EIO;
    goto cleanup;
  }
  fs = hdfsConnGetFs(conn);
  info = hdfsListDirectory(fs, path, &numEntries);
  if (numEntries) {
    ret = -ENOTEMPTY;
    goto cleanup;
  }

  if (hdfsDeleteWithTrash(fs, path, dfs->usetrash)) {
    ERROR("Error trying to delete directory %s", path);
    ret = -EIO;
    goto cleanup;
  }
  ret = 0;

View on GitHub (pinned to 2add963021)

Solutions

  1. Read the fuse-dfs stderr lines above this message for the fuseNewConnect root cause (kinit hint or hdfsBuilderConnect error code).
  2. Refresh Kerberos credentials for the accessing uid (kinit) and retry the rmdir - fuse-dfs builds a fresh connection per user.
  3. Verify namenode reachability and config: hdfs dfs -ls hdfs://<nn>:<port>/ with the same environment.
  4. Ensure the uid resolves via getent passwd.
  5. Restart fuse_dfs with a correct environment if stderr shows JVM startup failures.
Defensive patterns

Strategy: validation

Validate before calling

# before directory cleanup through the mount
klist -s || kinit "$USER"@EXAMPLE.COM
CLASSPATH="$(hdfs classpath --glob)" hdfs dfs -ls "${HDFS_URI:-hdfs://nn:8020/}" || exit 1

Try / catch

if (rmdir(mount_path) < 0 && errno == EIO) {
    /* connection failure, not ENOTEMPTY/EACCES - check fuse-dfs stderr */
    alert_backend_connection();
}

Prevention

When it happens

Trigger: rmdir on the fuse-dfs mount when getUsername(uid) fails, the uid's Kerberos ticket cache is missing (fuseNewConnect -> EACCES), or hdfsBuilderConnect fails (JVM will not start, wrong namenode URI/port, NameNode unreachable).

Common situations: Cleanup scripts running rmdir after the user's Kerberos ticket expired; fuse_dfs running on a host whose /tmp ticket cache was cleaned; uid not present in local passwd; CLASSPATH misconfigured at mount time.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/a78d70966b6e5030. Report an issue: GitHub.