Azure Logic Apps Timeout

Azure Logic Apps Timeout

Recently I got pulled into a production incident where a logic app was running for a long time (long time in this scenario was > 10 minutes), but the intention from the dev crew was they wanted this to time out in 60 seconds. These logic apps were a combination of HTTP triggers and Timer based.

Logic App Default Time Limits

First things to keep in mind are some default limits.

  1. If its a HTTP based trigger the default timeout is around 3.9 minutes

  2. For most others the default max run duration of a logic app is 90 days and min is 7 days

Ways To Change Defaults

With that, here are a couple of quick ways to make sure your Logic App times out and terminates within the time frame you set. Lets say if we want our Logic App to run no more than 60 seconds at max then:

  1. You can change the setting Runtime.Backend.FlowRunTimeout from the default 90 days to 7 days (keep in mind the minimum for this setting is 7 days which is quite large, refer to this issue : https://github.com/Azure/logicapps/issues/782#issuecomment-1609008805)
  • PRO: This will make sure that the Logic App runs for a maximum of 7 days only (which is quite large)
  • CON: However this will apply to all the Logic Apps in the host/tenant, meaning if you had 15 logic apps then all 15 will have the 7 day limit
  1. Have a branch with in the Logic App itself to control the timeout (shown in the below diagram)
  • PRO: You have full control of timeout per Logic App, so some can have 30 second time outs while others 60 seconds etc
  • CON: There will be an extra branch/logic in your logic app

Time-Out Branch In Logic App

Below is how a potential timeout out setting in a Logic App could look like. You create a “Delay” branch and set the desired time limit, in the example below its 2 minutes so if the other flow takes longer than two minutes then the delay will finish, logic app will be terminated and a cancelled status will be returned to the user in the below example. Shout out to my colleague John B for this awesome idea.

References

Author

Ricky Gummadi

Posted on

2022-10-20

Updated on

2023-08-18

Licensed under

Comments