apache/hadoop · error

EIO

EIO

Error message

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

What it means

Emitted by the fuse-dfs utimens handler when fuseConnectAsThreadUid() cannot obtain a libhdfs connection for the calling UID; timestamp updates fail with EIO. The handler needs the connection to call hdfsUtime with the atime/mtime taken from the timespec array; the connection failure happens before any HDFS metadata call.

Source

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

int dfs_utimens(const char *path, const struct timespec ts[2])
{
  struct hdfsConn *conn = NULL;
  hdfsFS fs;
  int ret = 0;
  dfs_context *dfs = (dfs_context*)fuse_get_context()->private_data;

  TRACE1("utimens", path)

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

  time_t aTime = ts[0].tv_sec;
  time_t mTime = ts[1].tv_sec;

  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);

  if (hdfsUtime(fs, path, mTime, aTime)) {
    hdfsFileInfo *info = hdfsGetPathInfo(fs, path);
    if (info == NULL) {
      ret = (errno > 0) ? -errno : -ENOENT;
      goto cleanup;
    }
    // Silently ignore utimens failure for directories, otherwise 
    // some programs like tar will fail.
    if (info->mKind == kObjectKindDirectory) {
      ret = 0;
    } else {
      ret = (errno > 0) ? -errno : -EACCES;

View on GitHub (pinned to 2add963021)

Solutions

  1. Check fuse-dfs stderr for the preceding fuseNewConnect/fuseConnect message naming the real cause.
  2. Refresh Kerberos tickets (kinit) for the accessing uid and retry the operation.
  3. Verify the mount's backend is reachable: hdfs dfs -ls hdfs://<nn>:<port>/ from the same environment.
  4. Ensure the uid exists in local passwd so uid->username resolution works.
  5. Restart fuse_dfs with the correct environment if JVM startup was the failure.
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

struct timespec ts[2] = {...};
if (utimensat(AT_FDCWD, mount_file, ts, 0) < 0 && errno == EIO) {
    /* hdfsUtime never ran: fuse-dfs connect failed for this uid */
    alert_backend_connection();
}

Prevention

When it happens

Trigger: touch on the mount, cp -p/rsync -a preserving times, when getUsername(uid) fails, the uid's Kerberos ticket cache is missing/stale (fuseNewConnect -> EACCES), or hdfsBuilderConnect fails (JVM/CLASSPATH, wrong namenode URI/port, NameNode down).

Common situations: Backup/sync tools (rsync -a, cp -p) running on a Kerberized mount after ticket expiry; fuse_dfs restarted without the Hadoop CLASSPATH; accessing uids without local passwd entries.

Related errors


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