aws-cdk-examples
aws-cdk-examples copied to clipboard
Example doesn't underline the importance of a good timeout set up.
Describe the bug
In the s3_sns_sqs_lambda_chain example, I found a practice that is not valid, and might lead in some configuration to an infinite loop.
The visibility timeout is set to 30 seconds, which is fine... only if the lambda timeout is 5 sec.
According to that doc, there should be a factor 6 between the 2 values. https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
If the lambda takes more that 30 seconds to run(which is unlikely in the example I agree) it will release the message again, triggering another lambda, etc...
I actually encounter that bug on production recently leading a 14 000$ overbilling.
Expected Behavior
The example should describe the relation between the 2 values. Maybe set a lambda time out constant and use that constant x6 calculation in the visibility_timeout parameter
Current Behavior
An infinite loop might be put in place.
Reproduction Steps
Add a wait 800 second in the lambda, and you'll reproduce the issue.
Possible Solution
apply recommendation of https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html link the 2 timeout.
Additional Information/Context
No response
CDK CLI Version
any
Framework Version
No response
Node.js Version
any
OS
any
Language
Python
Language Version
No response