Infinite loops occur in two situations:
  • An infinite loop occurs within a single function.
  • Multiple functions invoke each other, resulting in infinite recursion. For example, function A invokes function B, which then invokes function A.

Scenario 1: When a function times out, the system automatically terminates the function and you receive a timeout error. However, no financial loss is incurred.

Scenario 2: You can set the maximum number of pay-as-you-go instances for the target function to 0. Function invocations are then terminated. For more information, see Configure the maximum number of pay-as-you-go instances.