Search code examples
azureazure-functionsazure-logic-appsazure-durable-functionsazure-function-async

Azure Logic apps take hours/days to run Azure Functions


Background

I have a set of logic apps that each call a set function apps which are run in parallel.

Each logic app is triggered to start at a certain time during the night with all staggered an hour apart.

The Azure functions are written using the async pattern and call external APIs.

Problem

Sometimes the logic apps will run fine and complete their execution in a normal time period, and can do so for two or three days in a row.

However sometimes they will take hours or days forcing me to cancel their run.

enter image description here

Can any body shed any light on this might be happening?

Notes

  1. I'm using the latest nuget packages of the durable functions extension
  2. When debugging the functions always complete in a timely fashion
  3. I have noticed that the functions sometimes get stuck at pending.

Solution

  • It appears you have at least two function apps that are configured with the same storage account and task hub name:

    • AzureConsumptionXXX
    • AzureComputeXXX

    This causes the two function apps to steal messages from each other. If functions in one app do not exist in the other app, then it's very possible for orchestrations to get stuck in a Pending state like this.

    The simplest way to mitigate this is to give each function app a unique task hub name. Please see the Task Hubs documentation for more information: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-task-hubs.