Skip to content

JSII runs into OOM issues when spawned through jsii-srcmak #579

@DanielMSchmidt

Description

@DanielMSchmidt

Hi! 👋

Firstly, thanks for your work on this project! 🙂

I was running into problems with jsii-srcmak on CI on terraform-cdk where it would go OOM. When debugging this we found that calling JSII directly on the same source ran with a third of the memory and no issues.

Here is the diff that solved the problem for me, I aligned the helper in jsii-pacmak:

diff --git a/node_modules/jsii-srcmak/lib/util.js b/node_modules/jsii-srcmak/lib/util.js
index f2cc7e4..69ca1a3 100644
--- a/node_modules/jsii-srcmak/lib/util.js
+++ b/node_modules/jsii-srcmak/lib/util.js
@@ -47,6 +47,8 @@ async function exec(moduleName, args = [], options = {}) {
         const opts = {
             ...options,
             stdio: ['inherit', 'pipe', 'pipe'],
+            shell: true,
+            env: { ...process.env }
         };
         const child = (0, child_process_1.spawn)(process.execPath, [moduleName, ...args], opts);
         const data = new Array();

Would you be open to a PR including this change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions