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 Risposte
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
ESPERTO
con risposta 10 mesi fa
profile picture
ESPERTO
verificato 10 mesi fa
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
ESPERTO
con risposta 10 mesi fa
profile picture
ESPERTO
verificato 10 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande