{"record":{"id":"9e7fecd774db312c","repo":"apache/seatunnel","slug":"failed-to-clean-empty-transaction-parent-directory-9e7fec","errorCode":null,"errorMessage":"Failed to clean empty transaction parent directory: {}","messagePattern":"Failed to clean empty transaction parent directory: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java","lineNumber":614,"sourceCode":"\n    private void cleanupTransactionParentDirectories(String transactionDir) {\n        Path uuidDir = new Path(transactionDir).getParent();\n        if (uuidDir == null) {\n            return;\n        }\n        Path jobDir = uuidDir.getParent();\n        if (jobDir == null) {\n            return;\n        }\n        cleanupEmptyDirectory(uuidDir);\n        cleanupEmptyDirectory(jobDir);\n    }\n\n    private void cleanupEmptyDirectory(Path directory) {\n        try {\n            hadoopFileSystemProxy.deleteEmptyDirectory(directory.toString());\n        } catch (IOException e) {\n            log.warn(\"Failed to clean empty transaction parent directory: {}\", directory, e);\n        }\n    }\n\n    /**\n     * when a checkpoint completed, file connector should begin a new transaction and generate new\n     * transaction id\n     *\n     * @param checkpointId checkpoint id\n     */\n    public void beginTransaction(Long checkpointId) {\n        this.checkpointId = checkpointId;\n        this.transactionId = getTransactionId(checkpointId);\n        this.transactionDirectory = getTransactionDir(this.transactionId);\n        this.needMoveFiles = new LinkedHashMap<>();\n        this.partitionDirAndValuesMap = new LinkedHashMap<>();\n    }\n\n    private String getTransactionId(Long checkpointId) {","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java#L596-L632","documentation":"A WARN from AbstractWriteStrategy.cleanupEmptyDirectory (checkpoint/transaction cleanup path): deleting an empty per-transaction staging directory failed with an IOException. Written data files and checkpoint commits are unaffected; only an empty temp directory may remain under the output path.","triggerScenarios":"On checkpoint completion the write strategy moves finished files and then removes the transaction directory via hadoopFileSystemProxy.deleteEmptyDirectory; IOException from HDFS/S3 transient errors, permissions, or the directory containing leftover files.","commonSituations":"Permission differences between writer subtask users and the directory owner; S3 throttling during high-parallelism checkpoints; crashed previous runs leaving orphan files so the directory is not empty.","solutions":["Check filesystem permissions for the SeaTunnel worker user on the output directory","Inspect the directory for orphaned files from failed transactions and clean manually","Retry the job; the leftover empty directory is harmless and can be deleted","Monitor storage-side errors (HDFS safe mode, S3 5xx/429) coinciding with checkpoints"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: writer user needs delete rights on staging dir\n// hadoop fs -test -w /output/staging && echo ok","typeGuard":null,"tryCatchPattern":"// non-fatal; only empty dirs linger. Pattern for user-side cleanup:\n// try { fs.deleteEmptyDirectory(dir); } catch (IOException e) { log + manual sweep of /output/staging }","preventionTips":["Ensure the sink user owns/has delete permission on staging directories","Reduce checkpoint-time S3/HDFS load (throttle parallelism) if deletes time out","Periodically sweep the output path for empty *_txn* directories"],"tags":["file","checkpoint","cleanup"],"backgroundTag":"file-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}