pulumi: Nodejs >v18 throws exception
What happened?
Upgrading my dependencies to latest, pulled in Azure Native v2.47.0 and builds were all failing. I thought this was due to my changes but removing my changes still caused failures.
Downgrading and pinning to 2.46.0 fixed all issues
Example
resourceGroupName: `rg-${suffix}`,
location: 'centralus',
});
// TODO figure out how to handle password if we intend to do those
const sqlServer = new azureNative.sql.Server(
`sql-${pulumi.getStack()}`,
{
serverName: `${suffix}`,
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
administratorLogin: ######
administratorLoginPassword: #######
publicNetworkAccess: ServerPublicNetworkAccessFlag.Enabled,
restrictOutboundNetworkAccess: ServerNetworkAccessFlag.Disabled,
// minimalTlsVersion: '1.2',
version: '12.0',
},
{ parent: resourceGroup },
);
Output of pulumi about
This was running via github action but i can run again to verify versions if needed
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 23 (12 by maintainers)
Commits related to this issue
- Detect possible OOM errors when nodejs crashes The typical nodejs OOM messages are sometimes obscured by our use of the debugger API, making this hard to diagnose. Provide an actionable error message... — committed to pulumi/pulumi by julienp 2 years ago
- Detect possible OOM errors when nodejs crashes The typical nodejs OOM messages are sometimes obscured by our use of the debugger API, making this hard to diagnose. Provide an actionable error message... — committed to pulumi/pulumi by julienp 2 years ago
- Detect possible OOM errors when nodejs crashes The typical nodejs OOM messages are sometimes obscured by our use of the debugger API, making this hard to diagnose. Provide an actionable error message... — committed to pulumi/pulumi by julienp 2 years ago
- Detect possible OOM errors when nodejs crashes The typical nodejs OOM messages are sometimes obscured by our use of the debugger API, making this hard to diagnose. Provide an actionable error message... — committed to pulumi/pulumi by julienp 2 years ago
- Detect possible OOM errors when nodejs crashes (#16700) The typical nodejs OOM messages are sometimes obscured by our use of the debugger API, making this hard to diagnose. Provide an actionable erro... — committed to pulumi/pulumi by julienp 2 years ago
Thank you everyone for the additional information. I was able to reproduce this in Github Actions. After patching out our usage of the debugger API (which is what is showing up in the original stack traces), I get a much more familiar stack trace:
We’re running out of memory! Given that it does not fail 100% of the time, we must be right on the edge of the limit. Small internal changes in Nodejs in more recent versions might push us over the edge more often.
Nodejs configures the default limit for the heap based on the system it’s running on. I remember this heuristic having occasionally changed in the past.
Github Actions runners have 7GB of memory for private repos, and 16GB for public repos https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories, so if you run in a public repo you are unlikely to hit the issue (heap defaults to 4GB on these, vs 2GB on private runners).
Additionally, in containerised environments, this tries to take into account the available memory for the container, as opposed to total system memory. However this detection does not always work, for example older versions of nodejs (before 20.x) don’t detect container memory limits when using cgroups v2 https://github.com/nodejs/node/issues/47259. This was fixed in Nodejs 20.
The result is that when running with Nodejs 20 in a containerised environment like Kubernetes, we have less memory available for the heap. Since the azure provider is very large, we run into the limit.
Workaround
To work around all of this, you can explicitly set the heap size for Nodejs in
Pulumi.yamlThis issue has been addressed in PR #16700 and shipped in release v3.127.0.
@julienp thanks a lot for the thorough investigation and the clear explanation. Given the cryptic error message and the increased risk of bumping onto this issue, is there anything we should do to 1) try to mitigate this issue without user intervention? and 2) increase awareness and visibility so people find the workaround you proposed more easily?