Skip to content

fs: fix unhandled busy errors in RmSync#62611

Open
louiellan wants to merge 1 commit intonodejs:mainfrom
louiellan:fix-rmsync-unhandled-busy-err
Open

fs: fix unhandled busy errors in RmSync#62611
louiellan wants to merge 1 commit intonodejs:mainfrom
louiellan:fix-rmsync-unhandled-busy-err

Conversation

@louiellan
Copy link
Copy Markdown

@louiellan louiellan commented Apr 6, 2026

This fixes the unhandled busy errors in RmSync in the symlink_status call, because the allowed/retryable errors in RmSync could be thrown as early as symlink_status call, but it is only handled in the remove/remove_all calls and can only be retried from there. Without this, it bypasses the file_not_found check and recursive check in deleting a directory on ENFILE, EMFILE, EBUSY. It can also cause ENOTEMPTY error in the directory in a non-recursive option

This also fixes overridden errors that might happen in the symlink_status right before the remove/remove_all calls, that might mask the previous error

And this also fixes a subtle bug in the retryDelay because Sleep in Windows is already in ms units

Refs: #55555

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Apr 6, 2026
@louiellan
Copy link
Copy Markdown
Author

As for the test validating this fix, I don't know if I should, since i searched all throughout the codebase, I didn't see any tests testing the retries with the busy errors (e.g., ENFILE, EMFILE), and if I did I might introduce a flaky test if I do a ulimit configuration

@louiellan
Copy link
Copy Markdown
Author

#35689 might be related here as well

This fixes the unhandled busy errors in rmSync in the symlink_status
call, because the allowed/retryable errors in rmSync could be thrown
as early as symlink_status call, but it is only handled in the
remove/remove_all calls and can only be retried from there

This also fixes overridden errors that might happen in the
symlink_status right before the remove/remove_all calls, that might
mask the true cause of the error happening in rmSync

Refs: nodejs#55555
Signed-off-by: louiellan <louie.lou.llaneta@gmail.com>
@louiellan louiellan force-pushed the fix-rmsync-unhandled-busy-err branch from 3cecaa5 to 70c037c Compare April 7, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants