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

aws_eventbridge_lambdam- Issue with cdk synth when using existing role for lambda and overrideWarningsEnabled=true #1057

Open
vkondareddy-godaddy opened this issue Jan 25, 2024 · 11 comments
Labels
bug Something isn't working needs-triage The issue or PR still needs to be triaged

Comments

@vkondareddy-godaddy
Copy link

vkondareddy-godaddy commented Jan 25, 2024

aws_eventbridge_lambda - Using existing role for lambda has issue with cdk synth when overrideWarningsEnabled=true

Reproduction Steps

EventbridgeToLambda(
self,
"EventbridgeToLambda",
lambda_function_props=lambda_.FunctionProps(
code=lambda_.InlineCode(lambda_code),
handler="index.lambda_handler",
runtime=lambda_.Runtime.PYTHON_3_9,
role=iam.Role.from_role_arn(
self, id="x", role_arn="arn:aws:iam::numbers:path/rolename"
),
),
event_rule_props=events.RuleProps(
events.Schedule.rate(
Duration.hours(1)
)
),
)

Error Log

cdk ls or listing stack doesn't work with overrideWarningsEnabled=true

stack trace:

from aws_solutions_constructs.aws_eventbridge_lambda import (
File "\site-packages\aws_solutions_constructs
aws_eventbridge_lambda_init_.py", line 157, in
from .jsii import *
File "\site-packages\aws_solutions_constructs
aws_eventbridge_lambda_jsii_init
.py", line 14, in
import aws_solutions_constructs.core.jsii
File "\site-packages\aws_solutions_constructs
core_init
.py", line 96, in
from .jsii import *
File "\site-packages\aws_solutions_constructs
core_jsii_init
.py", line 16, in
jsii_assembly = jsii.JSIIAssembly.load(
File "\site-packages\jsii_runtime.py", line 5
5, in load
kernel.load(assembly.name, assembly.version, os.fspath(assembly_path))
File "\site-packages\jsii_kernel_init
.py"
, line 299, in load
self.provider.load(LoadRequest(name=name, version=version, tarball=tarball))
File "\site-packages\jsii_kernel\providers\pr
ocess.py", line 354, in load
return self._process.send(request, LoadResponse)
File "\site-packages\jsii_kernel\providers\pr
ocess.py", line 332, in send
self._next_message(), _ProcessResponse
File "\site-packages\jsii_kernel\providers\pr
ocess.py", line 251, in _next_message
return json.loads(self._process.stdout.readline(), object_hook=ohook)
KeyboardInterrupt
Error in atexit._run_exitfuncs:
ocess.py", line 295, in stop
self._process.stdin.close()
OSError: [Errno 22] Invalid argument

Environment

  • **CDK CLI Version :2.113.0
  • **CDK Framework Version:2.113.0
  • **AWS Solutions Constructs Version :2.47.0
  • **OS :windows
  • **Language :python

Other


This is 🐛 Bug Report

@vkondareddy-godaddy vkondareddy-godaddy added bug Something isn't working needs-triage The issue or PR still needs to be triaged labels Jan 25, 2024
@vkondareddy-godaddy vkondareddy-godaddy changed the title aws_eventbridge_lambda aws_eventbridge_lambdam- Issue with cdk synth when using existing role for lambda and overrideWarningsEnabled=true Jan 25, 2024
@biffgaut
Copy link
Contributor

Thanks - we'll take a look

@vkondareddy-godaddy
Copy link
Author

Error log:

PS > cdk ls
WARN AWS_SOLUTIONS_CONSTRUCTS_WARNING: An override has been provided for the property: tracing. Default value: 'Active'. You provided: 'Disabled'.
WARN AWS_SOLUTIONS_CONSTRUCTS_WARNING: An override has been provided for the property: tracing. Default value: 'Active'. You provided: 'Disabled'.
WARN AWS_SOLUTIONS_CONSTRUCTS_WARNING: An override has been provided for the property: encryption. Default value: 'KMS_MANAGED'. You provided: 'NONE'.

<--- Last few GCs --->

[16664:000002983F337660] 1430913 ms: Mark-sweep 3809.7 (4101.4) -> 3793.7 (4101.4) MB, 40288.8 / 0.0 ms (average mu = 0.057, current mu = 0.020) allocation failure; scavenge might not succeed
[16664:000002983F337660] 1442511 ms: Mark-sweep 3809.5 (4101.4) -> 3793.8 (4101.6) MB, 11548.4 / 0.0 ms (average mu = 0.041, current mu = 0.004) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF668241C7F node_api_throw_syntax_error+175855
2: 00007FF6681C6476 EVP_MD_meth_get_input_blocksize+59654
3: 00007FF6681C8160 EVP_MD_meth_get_input_blocksize+67056
4: 00007FF668C70434 v8::Isolate::ReportExternalAllocationLimitReached+116
5: 00007FF668C5B7C2 v8::Isolate::Exit+674
6: 00007FF668ADD65C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
7: 00007FF668AEA93D v8::internal::Heap::PublishPendingAllocations+1117
8: 00007FF668AE79C7 v8::internal::Heap::PageFlagsAreConsistent+3367
9: 00007FF668ADA0F7 v8::internal::Heap::CollectGarbage+2039
10: 00007FF668AF0AB3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
11: 00007FF668AF135D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
12: 00007FF668B00B20 v8::internal::Factory::NewFillerObject+816
13: 00007FF6687F1565 v8::internal::DateCache::Weekday+1349
14: 00007FF668D0D961 v8::internal::SetupIsolateDelegate::SetupHeap+558193
15: 00007FF5E92057DA
Traceback (most recent call last):
File "\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "\cdk\app.py", line 388, in
main()
File "\cdk\app.py", line 375, in main
EventBridgeLambdaStack(
File "\lib\site-packages\jsii_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "\lambda_stack.py", line 61, in init
event_bridge_lambda = EventbridgeToLambda(
File "\lib\site-packages\jsii_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "\lib\site-packages\aws_solutions_constructs\aws_eventbridge_lambda_init
.py", line 204, in init
jsii.create(self.class, self, [scope, id, props])
File "\lib\site-packages\jsii_kernel_init
.py", line 334, in create
response = self.provider.create(
File "\lib\site-packages\jsii_kernel\providers\process.py", line 365, in create
return self._process.send(request, CreateResponse)
File "\lib\site-packages\jsii_kernel\providers\process.py", line 332, in send
self._next_message(), _ProcessResponse
File "\lib\site-packages\jsii_kernel\providers\process.py", line 251, in _next_message
return json.loads(self.process.stdout.readline(), object_hook=ohook)
File "\AppData\Local\Programs\Python\Python39\lib\json_init
.py", line 359, in loads
return cls(**kw).decode(s)
File "\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "\lib\site-packages\jsii_kernel\providers\process.py", line 295, in stop
self._process.stdin.close()
OSError: [Errno 22] Invalid argument

@biffgaut
Copy link
Contributor

When we try to replicate this, we're not seeing the same error - but we are seeing an error. We'll fix the error we're seeing and let you know when it's available. You can try the new version and see if it addresses your issue as well.

@biffgaut
Copy link
Contributor

v2.50.0 corrects a problem when a role is provided in LambdaFunctionProps, please give it a try and see if it addresses your issue. Thanks.

@biffgaut
Copy link
Contributor

Correction - try 2.51.0, we had some version issues in 2.50.0 (unrelated to this issue)

@vkondareddy-godaddy
Copy link
Author

Hi @biffgaut, I tried with new version 2.51.0, but still seeing the same issue. I guess may be issue is with too many override warnings. I have around 5 stacks where I am using aws-solution-constructs and overriding default settings.

Here's the error log:
<--- Last few GCs --->

[14484:0000012F5C40A5C0] 1650071 ms: Mark-sweep 3834.0 (4101.3) -> 3818.2 (4101.5) MB, 14059.9 / 0.0 ms (average mu = 0.091, current mu = 0.025) a
llocation failure; scavenge might not succeed
[14484:0000012F5C40A5C0] 1728779 ms: Mark-sweep 3834.2 (4101.5) -> 3818.3 (4101.5) MB, 78634.0 / 0.0 ms (average mu = 0.015, current mu = 0.001) a
llocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF603311C7F node_api_throw_syntax_error+175855
2: 00007FF603296476 EVP_MD_meth_get_input_blocksize+59654
3: 00007FF603298160 EVP_MD_meth_get_input_blocksize+67056
4: 00007FF603D40434 v8::Isolate::ReportExternalAllocationLimitReached+116
5: 00007FF603D2B7C2 v8::Isolate::Exit+674
6: 00007FF603BAD65C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
7: 00007FF603BBA93D v8::internal::Heap::PublishPendingAllocations+1117
8: 00007FF603BB79C7 v8::internal::Heap::PageFlagsAreConsistent+3367
9: 00007FF603BAA0F7 v8::internal::Heap::CollectGarbage+2039
10: 00007FF603BC0AB3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
11: 00007FF603BC135D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
12: 00007FF603BD0B20 v8::internal::Factory::NewFillerObject+816
13: 00007FF6038C1565 v8::internal::DateCache::Weekday+1349
14: 00007FF603DDD961 v8::internal::SetupIsolateDelegate::SetupHeap+558193
15: 00007FF603D63472 v8::internal::SetupIsolateDelegate::SetupHeap+57218
16: 00007FF58430C76D
Traceback (most recent call last):
File "\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "\cdk\app.py", line 388, in
main()
File "\cdk\app.py", line 375, in main
LambdaStack(
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_runtime.py", line 1
18, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "\cdk\lambda_stack.py", line 61, in init
event_bridge_lambda = EventbridgeToLambda(
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_runtime.py", line 1
18, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, **kwargs)
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\aws_solutions_constructs
aws_eventbridge_lambda_init
.py", line 204, in init
jsii.create(self.class, self, [scope, id, props])
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_kernel_init
.py"
, line 334, in create
response = self.provider.create(
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_kernel\providers\pr
ocess.py", line 365, in create
return self._process.send(request, CreateResponse)
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_kernel\providers\pr
ocess.py", line 332, in send
self._next_message(), _ProcessResponse
File "\AppData\Local\pypoetry\Cache\virtualenvs-Lxi7jqtO-py3.9\lib\site-packages\jsii_kernel\providers\pr
ocess.py", line 251, in _next_message
return json.loads(self._process.stdout.readline(), object_hook=ohook)
obj, end = self.raw_decode(s, idx=_w(s, 0).end())

@biffgaut
Copy link
Contributor

Does it work when overrideWarnings is set to false?

@vkondareddy-godaddy
Copy link
Author

vkondareddy-godaddy commented Jan 31, 2024 via email

@biffgaut
Copy link
Contributor

biffgaut commented Feb 1, 2024

Are all 5 stacks in the same CDK app? It does sound like that could stress memory. Is there any way you can isolate it to the point where you could post code that breaks?

@vkondareddy-godaddy
Copy link
Author

Yes all 5 stacks are under same cdk app. I will check with my team and try to post code.
But I don't see the same memory problem when "overrideWarnings is set to false". I feel it's issue with the warnings

@biffgaut
Copy link
Contributor

biffgaut commented Feb 5, 2024

Any additional info you can provide to help us attempt to reproduce the error would be helpful, e.g.-

  • What constructs to each of the 5 stacks use?
  • How many defaults are you overriding? (and perhaps what they are)
  • The relationship between the stacks? (are they 5 independent stacks, or is there a parent/child relationship?)

The Restaurant Management use case in our repo uses 4 independent stacks without a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage The issue or PR still needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants