fix(mod_fs): use synchronous rm to avoid XFS metadata corruption when removing directories

This commit is contained in:
2026-03-05 14:44:14 +00:00
parent a3255fd1fb
commit d9c79ae4eb
3 changed files with 13 additions and 3 deletions

View File

@@ -122,10 +122,13 @@ export class FsHelpers {
}
/**
* Remove a directory recursively
* Remove a directory recursively.
* Uses synchronous rm to avoid XFS metadata corruption observed with
* async fs.promises.rm affecting sibling directory entries on the
* libuv thread pool under signal pressure.
*/
public static async removeDirectory(dirPath: string): Promise<void> {
await fs.promises.rm(dirPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
fs.rmSync(dirPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
}
/**