-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
cdk deploy: JavaScript heap out of memory #24183
Comments
Note: upgrading CDK to |
Hi @benjicarpy19 , thanks for reaching out. You might want to try the suggested solution provided in here. Similar to what has been asked in the linked issue, could you share the repro code and if that's not feasible, it would be great to answer about stacks and resources. |
Hi, As mentioned I have already tried the solution in the link you suggested and I am still seeing the issue persist. Here is the full construct that is likely causing te memory issue. As you can see there are many lambdas all with node_modules which I believe is what is likely cuasing the memory outage. Just to re-iterate setting
|
Is You could try: $ NODE_OPTIONS=--max_old_space_size=6000 cdk deploy or $ export NODE_OPTIONS=--max_old_space_size=6000
$ cdk deploy |
Oh interesting, you could well be right. Yes that is the actual command I was running. Is there a way to log overall memory usage after the |
No I don't think there is such a provision in place today. Your app could actually just periodically dump JS heap usage information out to STDERR or to a file, using a combination of |
Thanks, that could be worth running alongside the deploy operation. I am curious though as to why it is/ was timing out. If the default |
Describe the bug
I am running into a "JavaScript heap out of memory" error when running
cdk deploy
in my CI. I am using at3.large
instance which has 8GiB memory as shown here.I searched for this issue and it was mentioned that setting the
NODE_OPTIONS=--max_old_space_size
prior to runningcdk deploy
should fix the memory issue however when I amend thecdk deploy
command to be like so:NODE_OPTIONS=--max_old_space_size=6000 && cdk deploy
I still get the JavaScript heap out of memory issue even though I am limiting it to 6000 when my available memory should be 8000
Expected Behavior
I would expect with my defined node memory limit it should not run out of memory
Current Behavior
It currently runs out of memory while it appears to be creating the cloud formation template. Please see image below for reference in my CI
Reproduction Steps
I am unable to easily provide this i'm afraid, I am also not sure it is required to identify the issue. What I can provide is my general lambda configuration that causes the memory issue. I believe it is likely due to
node_modules
across 40 or so different lambdas creating large memory consumption. Unfortunately due to my setup it would be very difficult to migrate to using a lambda llayer to abstract the node_modules away from the lambda function asset bundles.Possible Solution
I did try using the
-no-asset-parallelism
flag however this makes deployment painfully slow as no assest run in parallel at all.Additional Information/Context
No response
CDK CLI Version
2.59.0
Framework Version
No response
Node.js Version
16.3.0
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: