apache/hadoop · warning

wildcard_expandPath: on closedir %s: %s

Error message

wildcard_expandPath: on closedir %s: %s

What it means

After scanning a wildcard classpath directory, wildcard_expandPath calls closedir; if it fails, 'on closedir <path>: <strerror>' is printed. Unlike the readdir failure this does not by itself set length = -1, so expansion may still succeed — the message mostly signals a broken directory stream (EBADF) or file-descriptor pressure.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:448

                    *dest = PATH_SEPARATOR;
                    dest++;

#ifdef _LIBHDFS_JNI_HELPER_DEBUGGING_ON_
                    printf("wildcard_expandPath:\t%s\t:\t%s\n",
                      filename, expanded);
#endif
                }
            }
        }

        if (errno != 0) {
            fprintf(stderr, "wildcard_expandPath: on readdir %s: %s\n",
              path, strerror(errno));
            length = -1;
        }

        if (closedir(dir) != 0) {
            fprintf(stderr, "wildcard_expandPath: on closedir %s: %s\n",
                    path, strerror(errno));
        }
    } else if ((errno != EACCES) && (errno != ENOENT) && (errno != ENOTDIR)) {
        // can not opendir due to an error we can not handle
        fprintf(stderr, "wildcard_expandPath: on opendir %s: %s\n", path,
                strerror(errno));
        length = -1;
    }

    if (length == 0) {
        // either we failed to open dir due to EACCESS, ENOENT, or ENOTDIR, or
        // we did not find any file that matches *.jar or *.JAR

#ifdef _LIBHDFS_JNI_HELPER_DEBUGGING_ON_
        fprintf(stderr, "wildcard_expandPath: can not expand %.*s*: %s\n",
                (int)(pathLength-1), path, strerror(errno));
#endif

View on GitHub (pinned to 2add963021)

Solutions

  1. Treat it as a warning and verify the expanded classpath still contains the needed jars
  2. Eliminate wildcard entries (use `hadoop classpath --glob` output) so the directory-scan code never runs
Defensive patterns

Strategy: fallback

Try / catch

/* warning only: verify the expanded CLASSPATH contains the needed jars */
# echo "$CLASSPATH" | tr ':' '\n' | grep hadoop-common

Prevention

When it happens

Trigger: closedir returning non-zero: an invalidated DIR handle, fd table corruption, or descriptor exhaustion at exactly that moment.

Common situations: Same environments as the other wildcard-expansion warnings: network mounts and concurrent modification of scanned classpath directories.

Related errors


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