Repository navigation
[node-core-library] Own Windows folder deletion retry policy - #6231
Closed
Ian Clanton-Thuon (iclanton) wants to merge 1 commit into
Closed
Ian Clanton-Thuon (iclanton) wants to merge 1 commit into
Ian Clanton-Thuon (iclanton) wants to merge 1 commit into
Conversation
Address microsoft#6230 with a whole-operation retry budget, compatible folder enumeration, and settled async child deletes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| "changes": [ | ||
| { | ||
| "packageName": "@rushstack/node-core-library", | ||
| "comment": "Retry `FileSystem` folder deletion operations on Windows only for errors reported as `EBUSY`, `ENOTEMPTY` or `EPERM`, with a shared budget of three retries and delays of 100, 200 and 300 ms. Fix `FileSystem.ensureEmptyFolder` and `FileSystem.ensureEmptyFolderAsync` compatibility with Node.js 20.9 and unbound calls, and ensure async child deletions settle before retrying or rejecting. `FileSystem.ensureEmptyFolderAsync` deletes at most 10 top-level children concurrently; `FileSystem.ensureEmptyFolder` and `FileSystem.ensureEmptyFolderAsync` throw on folder read errors other than `ENOENT`.", |
Collaborator
There was a problem hiding this comment.
This is summarizing the implementation details. Rewrite to concisely say what the point of this change is, and who's impacted.
Member
Author
|
Superseded by #6232 at the author's request. The replacement restarts from a specification independently reviewed by Claude Opus 5.5 and GPT-5.3 Codex, incorporates the changelog feedback, and will undergo independent branch reviews to consensus. Original branch and commit history are preserved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6230, addressing the follow-up feedback on #5836.
Make
FileSystem.deleteFolder,deleteFolderAsync,ensureEmptyFolder, andensureEmptyFolderAsyncshare a consistent Windows-only retry policy, without changing their public signatures. Also fix folder emptying on Node.js 20.9–20.11 and when the static methods are called unbound.Details
EBUSY,ENOTEMPTY, orEPERM. Allow three retries, waiting 100, 200, and 300 ms; propagate the final error through the existing exception decoration.maxRetries: 0andretryDelay: 0to Node, avoiding version-dependent native retry behavior and per-recursive-entry retry budgets. Use mockableAtomics.waitfor synchronous waits andAsync.sleepAsyncfor asynchronous waits.fs-extra.readdirSync/readdir, joining them with the supplied folder path instead of usingDirent.parentPathorthis.ENOENT; preserve other folder read errors, includingENOTDIRwhen a file occupies the path.Correction to the earlier PR's history
fs-extra7 used its own vendored rimraf implementation (lib/remove/rimraf.js), not a dependency onrimraf@2. ItsmaxBusyTries: 3retries applied only to asynchronousremove, on all platforms, with a separate counter at each recursive level. SynchronousremoveSyncinstead had a Windows-only spin of up to 500 ms on each folder's finalrmdir; exhausting that spin could return without throwing and leave the folder behind.fs-extra10 replaced that implementation with nativefs.rm/rmSyncwithout retry options.This change deliberately limits retries to Windows and keeps resource-exhaustion errors and
move/moveAsyncoutside its scope.How it was tested
On Linux with Node.js 24.22.1:
FileSystem.testandAsync.testsuites: 136 tests passed (86 filesystem tests and 50 async tests).rush prettier,git diff --cached --check, andrush change --verify --target-branch microsoft/mainpassed.The Windows retry policy is tested using mocked failures and sleeps, not real file locking.