{"record":{"id":"b3b3c96efb971336","repo":"apache/hadoop","slug":"exception-while-writing-data-to-persistent-storage","errorCode":null,"errorMessage":"Exception while writing data to persistent storage dir: ${realPmemDir}","messagePattern":"Exception while writing data to persistent storage dir: (.+?)","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":353,"sourceCode":"    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(\n            \"Failed to map the test file under \" + realPmemDir);\n      }\n      out.put(contents);\n      // Forces to write data to storage device containing the mapped file\n      out.force();\n      return realPmemDir;\n    } catch (IOException e) {\n      throw new IOException(\n          \"Exception while writing data to persistent storage dir: \" +\n              realPmemDir, e);\n    } finally {\n      if (out != null) {\n        out.clear();\n      }\n      if (testFile != null) {\n        IOUtils.closeStream(testFile);\n        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  }","sourceCodeStart":335,"sourceCodeEnd":371,"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#L335-L371","documentation":"Error \"Exception while writing data to persistent storage dir: ${realPmemDir}\" thrown in apache/hadoop.","triggerScenarios":"Pmem cache initialization when writing test data into the pmem directory throws, e.g. device full or I/O error.","commonSituations":"See trigger scenarios.","solutions":["Inspect the DataNode log for the underlying exception (I/O error, no space) and repair the pmem device.","Verify the pmem filesystem is healthy and writable; reformat and remount if corrupted."],"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-23T01:17:44.959Z"}