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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠