{"record":{"id":"eb3dd7dbfcd58ac2","repo":"apache/hadoop","slug":"unable-to-cleanup-unlinked-tmp-file","errorCode":null,"errorMessage":"Unable to cleanup unlinked tmp file {}","messagePattern":"Unable to cleanup unlinked tmp file (.+?)","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/BlockPoolSlice.java","lineNumber":570,"sourceCode":"      }\n    }\n    if (!exceptions.isEmpty()) {\n      throw MultipleIOException.createIOException(exceptions);\n    }\n  }\n\n  /**\n   * Recover an unlinked tmp file on datanode restart. If the original block\n   * does not exist, then the tmp file is renamed to be the\n   * original file name and the original name is returned; otherwise the tmp\n   * file is deleted and null is returned.\n   */\n  File recoverTempUnlinkedBlock(File unlinkedTmp) throws IOException {\n    File blockFile = FsDatasetUtil.getOrigFile(unlinkedTmp);\n    if (blockFile.exists()) {\n      // If the original block file still exists, then no recovery is needed.\n      if (!fileIoProvider.delete(volume, unlinkedTmp)) {\n        throw new IOException(\"Unable to cleanup unlinked tmp file \" +\n            unlinkedTmp);\n      }\n      return null;\n    } else {\n      fileIoProvider.rename(volume, unlinkedTmp, blockFile);\n      return blockFile;\n    }\n  }\n\n\n  /**\n   * Move replicas in the lazy persist directory to their corresponding locations\n   * in the finalized directory.\n   * @return number of replicas recovered.\n   */\n  private int moveLazyPersistReplicasToFinalized(File source)\n      throws IOException {\n    File[] files = fileIoProvider.listFiles(volume, source);","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java#L552-L588","documentation":"Error \"Unable to cleanup unlinked tmp file {}\" thrown in apache/hadoop.","triggerScenarios":"Volume scanning/cleanup when an unlinked tmp block file cannot be deleted, typically a permissions or filesystem error.","commonSituations":"See trigger scenarios.","solutions":["Check the DataNode log for the underlying IOException cause (permissions, busy file, failed disk).","Verify the volume filesystem is healthy; run fsck if needed and restart the DataNode so cleanup is retried.","Manually remove the stale .unlinked tmp file if the filesystem is healthy but the file was left behind."],"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"}