You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.promises.rm recursive on a huge directory-tree with missing permissions can result in OOM #56433
While trying to delete a folder without permissions to delete the content of the folder fs.rm takes huge amounts of RAM with potential OOM-Exceptions down the road.
Steps to reproduce:
Create a complex folder tree (see following script as an example)
Ensure user that executes fs.rm has permission to delete rootfolder but does not have permissions to delete content of the rootfolder.
Execute Deletion Script
The testscript did not result in an OOM-exception for me (it stopped at ~8gb RAM usage). You can just create more files to run into an OOM eventually (it broke in production with an OOM for us).
changed the title [-]fs.rm recursive on a huge directory-tree with missing permissions can result in OOM[/-][+]`fs.promises.rm` recursive on a huge directory-tree with missing permissions can result in OOM[/+]on Jan 2, 2025
Activity
[-]fs.rm recursive on a huge directory-tree with missing permissions can result in OOM[/-][+]`fs.promises.rm` recursive on a huge directory-tree with missing permissions can result in OOM[/+]viyaha commentedon Jan 2, 2025
Memory Consumption is not only happening for fs.promises.rm, but for fs.rm also.
richytong commentedon Apr 5, 2026
Having the same issues, was able to resolve my own with the following code:
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows
fs: do not treat EPERM as ENOTEMPTY on Windows