{"record":{"id":"885250a17093b490","repo":"apache/hadoop","slug":"wildcard-expandpath-on-closedir-s-s","errorCode":null,"errorMessage":"wildcard_expandPath: on closedir %s: %s\n","messagePattern":"wildcard_expandPath: on closedir (.+?): (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c","lineNumber":448,"sourceCode":"                    *dest = PATH_SEPARATOR;\n                    dest++;\n\n#ifdef _LIBHDFS_JNI_HELPER_DEBUGGING_ON_\n                    printf(\"wildcard_expandPath:\\t%s\\t:\\t%s\\n\",\n                      filename, expanded);\n#endif\n                }\n            }\n        }\n\n        if (errno != 0) {\n            fprintf(stderr, \"wildcard_expandPath: on readdir %s: %s\\n\",\n              path, strerror(errno));\n            length = -1;\n        }\n\n        if (closedir(dir) != 0) {\n            fprintf(stderr, \"wildcard_expandPath: on closedir %s: %s\\n\",\n                    path, strerror(errno));\n        }\n    } else if ((errno != EACCES) && (errno != ENOENT) && (errno != ENOTDIR)) {\n        // can not opendir due to an error we can not handle\n        fprintf(stderr, \"wildcard_expandPath: on opendir %s: %s\\n\", path,\n                strerror(errno));\n        length = -1;\n    }\n\n    if (length == 0) {\n        // either we failed to open dir due to EACCESS, ENOENT, or ENOTDIR, or\n        // we did not find any file that matches *.jar or *.JAR\n\n#ifdef _LIBHDFS_JNI_HELPER_DEBUGGING_ON_\n        fprintf(stderr, \"wildcard_expandPath: can not expand %.*s*: %s\\n\",\n                (int)(pathLength-1), path, strerror(errno));\n#endif\n","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c#L430-L466","documentation":"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.","triggerScenarios":"closedir returning non-zero: an invalidated DIR handle, fd table corruption, or descriptor exhaustion at exactly that moment.","commonSituations":"Same environments as the other wildcard-expansion warnings: network mounts and concurrent modification of scanned classpath directories.","solutions":["Treat it as a warning and verify the expanded classpath still contains the needed jars","Eliminate wildcard entries (use `hadoop classpath --glob` output) so the directory-scan code never runs"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"/* warning only: verify the expanded CLASSPATH contains the needed jars */\n# echo \"$CLASSPATH\" | tr ':' '\\n' | grep hadoop-common","preventionTips":["Use `hadoop classpath --glob` output so closedir/readdir never run","Keep classpath directories immutable while clients start"],"tags":["hdfs","libhdfs","classpath","closedir","wildcard-expansion"],"backgroundTag":"classpath-expansion-failure","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}