Recursive Loop error stopping lambda execution

0

Hi, I have a use case where a lambda L1 triggers lambda L2 again via SQS msg with a small delay. I need to keep doing this untill a specific time which I am maintaining in my Logic. However Lambda execution is being stopped at 16 executions sighting recursive loop error. How can I resolve this issue?

Also, if I use Step Function to design the process.. would it help is fixing this issue?

2 回答
1

Yes, I think Step Functions would be useful for architectures that loop Lambda.
The following documents may be helpful in setting up loops.
https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-create-iterate-pattern-section.html

Also, I believe the following update caused it to stop after the 16th loop.
https://aws.amazon.com/about-aws/whats-new/2023/07/aws-lambda-detects-recursive-loops-lambda-functions/?nc1=h_ls

It is also recommended that billing alerts be set up when setting up a large number of loops, as they can result in large fees.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html

profile picture
专家
已回答 10 个月前
profile picture
专家
已审核 10 个月前
0

Hi, it seems that you know exactly what you do these recursive calls.

In that case you can allow them without a stop at 16: see https://aws.amazon.com/blogs/compute/detecting-and-stopping-recursive-loops-in-aws-lambda-functions/

Disabling recursion detection
You may have valid use-cases where Lambda recursion is intentional as part 
of your design. In this case, use caution and implement suitable guardrails to prevent 
unexpected charges to your account. To learn more about best practices for using recursive 
invocation patterns, see Recursive patterns that cause run-away Lambda functions in the 
AWS Lambda Operator Guide.

This feature is turned on by default to stop recursive loops. To request turning it off for your 
account, reach out to AWS Support.

Best,

Didier

profile pictureAWS
专家
已回答 10 个月前
profile picture
专家
已审核 10 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则