{"record":{"id":"817c6b418bfbf911","repo":"apache/hadoop","slug":"pmemdir-is-not-a-directory","errorCode":null,"errorMessage":"${pmemDir} is not a directory","messagePattern":"(.+?) is not a directory","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemVolumeManager.java","lineNumber":327,"sourceCode":"      usedBytesCounts.get(volumeIndex).reserve(usedBytes);\n    }\n    return keyToMappableBlock;\n  }\n\n  public void recoverBlockKeyToVolume(ExtendedBlockId key, byte volumeIndex) {\n    blockKeyToVolume.put(key, volumeIndex);\n  }\n\n  @VisibleForTesting\n  static File verifyIfValidPmemVolume(File pmemDir)\n      throws IOException {\n    if (!pmemDir.exists()) {\n      final String message = pmemDir + \" does not exist\";\n      throw new IOException(message);\n    }\n    if (!pmemDir.isDirectory()) {\n      final String message = pmemDir + \" is not a directory\";\n      throw new IllegalArgumentException(message);\n    }\n\n    File realPmemDir = new File(getRealPmemDir(pmemDir.getPath()));\n    if (!realPmemDir.exists() && !realPmemDir.mkdir()) {\n      throw new IOException(\"Failed to create \" + realPmemDir.getPath());\n    }\n\n    String uuidStr = UUID.randomUUID().toString();\n    String testFilePath = realPmemDir.getPath() + \"/.verify.pmem.\" + uuidStr;\n    byte[] contents = uuidStr.getBytes(StandardCharsets.UTF_8);\n    RandomAccessFile testFile = null;\n    MappedByteBuffer out = null;\n    try {\n      testFile = new RandomAccessFile(testFilePath, \"rw\");\n      out = testFile.getChannel().map(FileChannel.MapMode.READ_WRITE, 0,\n          contents.length);\n      if (out == null) {\n        throw new IOException(","sourceCodeStart":309,"sourceCodeEnd":345,"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#L309-L345","documentation":"Error \"${pmemDir} is not a directory\" thrown in apache/hadoop.","triggerScenarios":"Pmem cache initialization when a configured dfs.datanode.pmem.cache.dirs entry points to a file rather than a directory.","commonSituations":"See trigger scenarios.","solutions":["Point dfs.datanode.pmem.cache.dirs at a directory, not a regular file; fix or replace the offending path.","Recreate the path as a directory on the pmem mount."],"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"}