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
After creating a repo with 250+ libraries, NX will exhaust available memory and crash when trying to build the project graph from scratch (such as after running nx reset).
When I say it exhausts all memory, on my workstation, the node process will show (in activity monitor) that it's consuming 30+ GB of memory.
With 250+ libraries in the NX repo, I can't even run npm install as it invokes an nx postinstall script that also crashes
Note that the point of failure may depend on the available memory on your computer. On my dev machine (16GB or RAM) that number is around the 250 library mark.
The attached gzipped node script can be used to generate a repo. Note that NX commands will work in the newly created repo until nx reset is invoked makeTestRepo.js.gz
Expected Behavior
The process graph is rebuilt without consuming 10s of gigs of memory and without crashing
observe the crash output from an nx postinstall script
Using the attached script
create a target directory (eg, test)
unzip the makeTestRepo.js.gz file in the test directory
read through the makeTestRepo.js to verify I'm not doing anything evil to you ;)
execute "node makeTestRepo.js". It will create a test repo and create 300 empty libraries in it.
cd test-repo
verify the existence of the libraries in test-repo/libs
verify that you can run nx commands such as "npx nx report"
run npx nx reset
run npx nx report
wait and observe. a node process will consume multiple gigs of memory, eventually crashing. nx cli will show an error. If using the daemon, there will be some (not very useful) logs in the daemon.log file
The threshold of approximately 250 libraries seems dependent on the amount of RAM available to the test machine. 250 is the approximate number on my 16GB dev workstation. It's much lower on the 4GB linux VM I was playing around with when making the repro case
The text was updated successfully, but these errors were encountered:
Apply the same patch for `@swc-node/register` that we did for `ts-node`.
This prevent errors during graph construction.
<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->
## Current Behavior
<!-- This is the behavior we have today -->
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes#26798
Apply the same patch for `@swc-node/register` that we did for `ts-node`.
This prevent errors during graph construction.
<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->
## Current Behavior
<!-- This is the behavior we have today -->
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes#26798
(cherry picked from commit 8cf96cc)
Current Behavior
After creating a repo with 250+ libraries, NX will exhaust available memory and crash when trying to build the project graph from scratch (such as after running nx reset).
When I say it exhausts all memory, on my workstation, the node process will show (in activity monitor) that it's consuming 30+ GB of memory.
With 250+ libraries in the NX repo, I can't even run npm install as it invokes an nx postinstall script that also crashes
Note that the point of failure may depend on the available memory on your computer. On my dev machine (16GB or RAM) that number is around the 250 library mark.
The attached gzipped node script can be used to generate a repo. Note that NX commands will work in the newly created repo until nx reset is invoked
makeTestRepo.js.gz
Expected Behavior
The process graph is rebuilt without consuming 10s of gigs of memory and without crashing
GitHub Repo
https://github.com/frobean/nx-repro-crash
Steps to Reproduce
From the github repo linked above
Using the attached script
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
The threshold of approximately 250 libraries seems dependent on the amount of RAM available to the test machine. 250 is the approximate number on my 16GB dev workstation. It's much lower on the 4GB linux VM I was playing around with when making the repro case
The text was updated successfully, but these errors were encountered: