-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs.rmdirSync stuck in busy-loop on Windows #34580
Comments
The busy-loop is reproduced on Linux if |
/ping @nodejs/platform-windows @nodejs/fs |
I can confirm. Easy fix: diff --git a/lib/internal/fs/rimraf.js b/lib/internal/fs/rimraf.js
index e88dd9697b..bdf731ba04 100644
--- a/lib/internal/fs/rimraf.js
+++ b/lib/internal/fs/rimraf.js
@@ -229,6 +229,8 @@ function _rmdirSync(path, options, originalErr) {
} catch (err) {
if (err.code === 'ENOENT')
return;
+ if (err.code === 'EACCES')
+ throw err;
if (err.code === 'ENOTDIR')
throw originalErr;
Someone should probably take a long, hard look at that function though. It recognizes a few error codes and ignores all others. Not a recipe for success. |
FYI, I had this problem in node 14.4.0 as well. Updated to 14.16.1 EDIT: Wait, no! ... I'm actually encountering a different (worse?) problem in node 14.16.1 - it's failing silently! So when running the code from the original bug report: expected behavior: fails with an error behavior in node 14.4.0: infinite loop behavior in node 14.16.1: fails without error @Lxxyx what did you test for when testing various node versions? Did you test for an error? |
fix rmsync swallowing errors instead of throwing them. fixes: nodejs#38683 fixes: nodejs#34580
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
The bug reliably reprodices on windows.
What is the expected behavior?
I expect
fs.rmdirSync()
to fail the same way asfs.rmdir()
does. But it does not.Linux produces expected behavior throwing an error:
Windows async
fs.rmdir({recursive:true})
instead offs.rmdirSync()
gives expected behavior as well, it passes an error to the callback:What do you see instead?
Node process is stuck with 100%-CPU busy-loop.
Additional information
Process Monitor suggests a busy-loop while endlessly retrying to delete a file, the log excerpt is pasted below:
The text was updated successfully, but these errors were encountered: