-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(cli): OOM with deeply nested stacks #33064
Comments
I have collected all other possibly related memory issues: #24183 |
@rehanvdm Good afternoon. Could you please check if guidance provided in https://stackoverflow.com/questions/48387040/how-do-i-determine-the-correct-max-old-space-size-for-node-js works for you? I'm unsure if we have any guidance or baseline defined for your scenario. |
That does not seem to make a difference, if even at all. I tried both these methods:
Then running just:
This is why I mentioned in the ticket that I did not mess with any NODE_OPTIONS. Because it is an uphill battle at this point. Somewhere in the CDK CLI code something is recursing and can not handle deeply nested dependencies. Even if it worked, it's just treating the symptoms and not the problem. Adding 1 more wave or stack can send it flying off and error on OOM again. It's also worth noting that the CPU for the node process is at 100% the whole time running the tests. I have found that the Uncommenting it, as a proof for debugging, I noticed that the |
Describe the bug
When stacks depend on each other in a long chain or if there are many stacks then the CLI slows down. In certain conditions, it will throw an Out Out Memory (OOM) error.
This is better explained with an example:
This is how it looks visually, 3 Waves, each with 2 stacks.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The CDK should not be limited by the number of "nesting" of stack dependencies
Current Behavior
It slows to a crawl and throws OOM for anything over 10 Waves with 5 stacks in them for me on a Mac M2 Pro, 16 GB, without touching NODE_OPTIONS.
Reproduction Steps
I have prepared this repo: https://github.com/rehanvdm/cdk-issue-slow-stack-dependencies
But the code is as simple as:
The following command is ran to just do the synth, the same thing happens on all CDK commands:
Possible Solution
No response
Additional Information/Context
I will show reduced logs of two scenarios:
console.log
after the.addDependency
is fast, but then after the last one there are multiple seconds that pass before the next debug output and the command completes.console.log
after the.addDependency
visibly slows down, where seconds pass between these calls. These also finish printing, then multiple seconds pass before an OOM error is thrown.Scenario 1 Logs
Notice 18 seconds since the last console.log and next CDK CLI output.
Scenario 2 Logs
CDK CLI Version
2.176.0
Framework Version
2.176.0
Node.js Version
v20.15.0
OS
Mac M2
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: