Aws-cdk: Maximum call stack size exceeded - python 3.6 - jsii 0.21.1

Created on 20 Jan 2020  路  6Comments  路  Source: aws/aws-cdk

We are currently working with CDK to deploy multiple stacks that create an ECS Cluster/tasks and ALBs.
Deploying more than a certain number of stacks simultaneously creates the error reported bellow. Deploying the stacks individually works perfectly.
I wanted to note that in my code I'm passing some cdk objects from stack to stack like in the example in this link:
https://github.com/aws-samples/aws-cdk-examples/blob/master/python/codepipeline-docker-build/Base.py#L68-L70
https://github.com/aws-samples/aws-cdk-examples/blob/master/python/codepipeline-docker-build/app.py#L12-L15

Reproduction Steps

I don't have any easy way to reproduce the steps without sharing confidential code.

Error Log

$ cdk synthesize -c "deploy=stg"

/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13374
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at new Uint8Array (<anonymous>)
    at new FastBuffer (internal/buffer.js:944:1)
    at Function.alloc (buffer.js:358:10)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13350:33)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
    at SyncStdio.readLine (/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13379:25)
Traceback (most recent call last):
  File "infrastructure.py", line 165, in <module>
    ecs_task_name=ecs_task['name']
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/stacks/alb.py", line 53, in __init__
    route_table_id=subnet_route_table
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/aws_cdk/aws_ec2/__init__.py", line 23182, in from_subnet_attributes
    return jsii.sinvoke(cls, "fromSubnetAttributes", [scope, id, attrs])
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_kernel/__init__.py", line 113, in wrapped
    return _recursize_dereference(kernel, fn(kernel, *args, **kwargs))
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_kernel/__init__.py", line 307, in sinvoke
    args=_make_reference_for_native(self, args),
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_kernel/providers/process.py", line 351, in sinvoke
    return self._process.send(request, InvokeResponse)
  File "/Users/med.bensalem/WorkSpace/repos/devops.cdk-pipeline/infrastructure/.env/lib/python3.6/site-packages/jsii/_kernel/providers/process.py", line 307, in send
    self._process.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe
Subprocess exited with error 1

Environment

  • *CDK CLI Version :1.21.0*
  • *JSII Version:0.21.1*
  • *OS :OSX Catalina*
  • *Language :python 3.6*

This is :bug: Bug Report

bug closing-soon

Most helpful comment

I confirm that reversing back to node 12, solved the issue.

All 6 comments

Hey there! Some questions for you about this issue.

  1. Was the code that is currently breaking working with previous versions of CDK or JSII?
  2. Was the application working as expected until it got beyond some certain # of stacks or beyond some other parameter that you know of?
  3. Can you provide some high level information about the layout of your stacks? I.E. Stack one creates VPC and security groups, Stack 2 creates ECS Cluster referencing VPC and SGs from Stack 1 etc...
  4. Also when you say deploying stacks simultaneously, does that mean deploying a single stack that has dependencies on other stacks that then get auto-deplyoed or does that mean cdk deploy Stack1 Stack2 Stack3 and the stacks don't necessarily depend on each other?
  5. Does the code break on any command other than deploy? i.e.cdk diff or cdk synth

Looks like this could be stemming from a known issue with JSII running on NodeJS >= 13.2. What is your current Node Version?

See https://github.com/aws/jsii/issues/1142 for more info on that.

@MrArnoldPalmer I was experiencing this issue. Using nvm use 12 to force my node version from 13.7 to 12 did the trick. Thanks!

I confirm that reversing back to node 12, solved the issue.

I confirm that reversing back to node 12, solved the issue.

worked for me too!

I confirm that reversing back to node 12, solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NukaCody picture NukaCody  路  3Comments

Kent1 picture Kent1  路  3Comments

peterdeme picture peterdeme  路  3Comments

abelmokadem picture abelmokadem  路  3Comments

slipdexic picture slipdexic  路  3Comments