{"record":{"id":"045f51230ea41103","repo":"apache/hadoop","slug":"failed-to-create-cachedir","errorCode":null,"errorMessage":"Failed to create ${cacheDir}","messagePattern":"Failed to create (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemVolumeManager.java","lineNumber":380,"sourceCode":"        NativeIO.POSIX.munmap(out);\n        try {\n          FsDatasetUtil.deleteMappedFile(testFilePath);\n        } catch (IOException e) {\n          LOG.warn(\"Failed to delete test file \" + testFilePath +\n              \" from persistent memory\", e);\n        }\n      }\n    }\n  }\n\n  /**\n   * Create cache subdirectory specified with blockPoolId.\n   */\n  public void createBlockPoolDir(String bpid) throws IOException {\n    for (String volume : pmemVolumes) {\n      File cacheDir = new File(volume, bpid);\n      if (!cacheDir.exists() && !cacheDir.mkdir()) {\n        throw new IOException(\"Failed to create \" + cacheDir.getPath());\n      }\n    }\n  }\n\n  public static String getRealPmemDir(String rawPmemDir) {\n    return new File(rawPmemDir, CACHE_DIR).getAbsolutePath();\n  }\n\n  /**\n   * Choose a persistent memory volume based on a specific algorithm.\n   * Currently it is a round-robin policy.\n   *\n   * TODO: Refine volume selection policy by considering storage utilization.\n   */\n  synchronized Byte chooseVolume(long bytesCount) throws IOException {\n    if (count == 0) {\n      throw new IOException(\"No usable persistent memory is found\");\n    }","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemVolumeManager.java#L362-L398","documentation":"Error \"Failed to create ${cacheDir}\" thrown in apache/hadoop.","triggerScenarios":"Pmem cache initialization when the per-volume cache directory cannot be created.","commonSituations":"See trigger scenarios.","solutions":["Ensure the pmem volume is writable and has free space so the cache directory can be created.","Fix ownership/permissions on the pmem mount for the DataNode user."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}