Skip to content
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

Jsii maximum call stacksize excedeed on Ubuntu 20.04 when using boto3 and cdk #8397

Closed
cadubentzen opened this issue Jun 5, 2020 · 1 comment · Fixed by aws/jsii#1717
Closed
Assignees
Labels
bug This issue is a bug. jsii This issue originates in jsii, or this feature must be implemented in jsii. language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged. os/linux Related specifically to Linux behavior

Comments

@cadubentzen
Copy link

cadubentzen commented Jun 5, 2020

When running some boto3 commands before calling core.App() in a cdk project, jsii-runtime.js breaks with RangeError: Maximum call stack size exceeded

Reproduction Steps

import boto3
from aws_cdk import core
import time


class SimplestBreakageStack(core.Stack):
    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)


sts = boto3.client('sts')
response = sts.get_caller_identity()
time.sleep(5)

app = core.App()
SimplestBreakageStack(app, "simplest-breakage")

app.synth()

and cdk synth

Error Log

/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13582
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at new Uint8Array (<anonymous>)
    at new FastBuffer (internal/buffer.js:945:1)
    at Function.alloc (buffer.js:376:10)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13558:33)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
    at SyncStdio.readLine (/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:13587:25)
Traceback (most recent call last):
  File "app.py", line 17, in <module>
    app = core.App()
  File "/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/aws_cdk/core/__init__.py", line 8844, in __init__
    jsii.create(App, self, [props])
  File "/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_kernel/__init__.py", line 224, in create
    response = self.provider.create(
  File "/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 333, in create
    return self._process.send(request, CreateResponse)
  File "/home/bentzen/examples/simplest-breakage/.env/lib/python3.8/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

  • CLI Version : aws-cli/1.18.66 Python/3.8.2 Linux/5.4.0-33-generic botocore/1.16.16
  • Framework Version: aws-cdk == 1.44.0 and boto3 == 1.13.23
  • Node.js Version: v12.18.0
  • OS : Ubuntu 20.04
  • Language (Version): Python 3.8.3

Other

Downgrading to Node v10.21.0, I'm not able to reproduce the issue anymore.

EDIT: after testing some versions, it seems to start breaking at Node v12.17.0. Until v12.16.3 it works fine


This is 🐛 Bug Report

@cadubentzen cadubentzen added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 5, 2020
@SomayaB SomayaB added the jsii This issue originates in jsii, or this feature must be implemented in jsii. label Jun 8, 2020
@SomayaB SomayaB added language/python Related to Python bindings os/linux Related specifically to Linux behavior labels Jun 8, 2020
@MrArnoldPalmer
Copy link
Contributor

This should be solved by aws/jsii#1717.

mergify bot pushed a commit to aws/jsii that referenced this issue Jun 11, 2020
…eadLine (#1717)

When using node `>= 12.17`, `EAGAIN` errors consistently occur when
trying to read from `stdin` when there is no available data. The retry
mechanism for this was to recursively call back `SyncStdio.readLine`,
which could evtnually lead to a "Maximum call stack size exceeded" error
to occur (possibly hidden from the consumer, and later causing a "Stream
closed" error).

This changes how the retry mechanism works so it operates in a `while`
loop instead of making a recursive call, completely avoiding to run into
the growing stack issue.

Fixes aws/aws-cdk#8288
Fixes aws/aws-cdk#5187
Fixes aws/aws-cdk#8397


---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. jsii This issue originates in jsii, or this feature must be implemented in jsii. language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged. os/linux Related specifically to Linux behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants