-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix(core): Handle removing non-empty directories and non-existing paths in cache #23279
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit fe2ca29. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
Thank you so much for isolating the issue! Hm, this removes the usage of our rust implementation of removing files where we also use a https://github.com/nrwl/nx/blob/master/packages/nx/src/native/cache/file_ops.rs#L8 The rust one proved to be much faster so we should continue using that one and address the issue there. @Exelord If you're familiar with Rust, we would appreciate if you continue looking into the issue. If not, no worries, you've been a great help already. @AgentEnder can take over from here. |
Great! Please do take over. I have tried to use rust fs-extra but it does not work the way described, so it would require some native implementation which I cannot help with. While JS remove might be slower it does fix the issue, so I went with that as a quick fix. Thank you :) |
Small, update. As in other places, the remove errors have been ignored as OS still can throw lock errors while trying to remove files used by concurrent process. (there is no fix for that - OS intended, but the file will be scheduled for remove) While its still using remove from fs-extra, it works now, which is faster than using rust's remove which throws. |
Hey guys, Would love to see this merged. My enterprise team has been dealing with this issue for awhile now and would love to see a fix :) @AgentEnder Can you assist? |
Current Behavior
When running NX concurrently sometimes NX is trying to remove non-existing path (which have been already deleted by other process) or non-empty directories (which contains files created by other process but not yet removed)
To prevent race conditions, remove from fs-extra works in following way:
Expected Behavior
Remove operations should work with non-existing paths as well as non-empty directories
Related Issue(s)
Fixes #22140