I have a durable azure function (2.0) that calls back on itself for an eternal orchestration, based on this article. Code below. This works fine and runs well for approx 20 minutes (say around 50 iterations). However, after this time it goes to sleep and stops working. If I navigate to the Azure portal and just click on the functions app and click the functions list (i.e. I just click around but don't change any settings or stop/start anything) it suddenly "wakes up" and continues on no problem. There are no errors or issues in the logs, just a indication of the inactive period and then the logs resuming. Am I missing a setting somewhere?
public static async Task Run([OrchestrationTrigger] DurableOrchestrationContextBase ctx, ILogger log)
{
try
{
var config = ctx.GetInput<Config>();
config = await ctx.CallActivityAsync<Config>("GetConfig", null);
await ctx.CallActivityAsync("ProcessDetails", config);
var nextCheckpoint = ctx.CurrentUtcDateTime.AddSeconds(config.PollingIntervalInSeconds);
await ctx.CreateTimer(nextCheckpoint, CancellationToken.None);
ctx.ContinueAsNew(config);
}
catch (Exception ex)
{
log.LogError($"[Error!][Failed with: {ex.ToString()}]");
throw;
}
}
After hitting the refresh button as described by @davidebbo the issue still persists, see log below.
Further update, even though the issue on GitHub appears resolved, I still needed to do the double config setting as indicated below in order to get my function reliable.
{
"version": "2.0",
"extensions": {
"durableTask": {
"HubName": "myHub",
"maxConcurrentActivityFunctions": 10,
"maxConcurrentOrchestratorFunctions": 1
}
},
"durableTask": {
"HubName": "myHub",
"maxConcurrentActivityFunctions": 10,
"maxConcurrentOrchestratorFunctions": 1
},
"functionTimeout": "00:10:00"
}
Now still having issues after much code optimisation, even though metrics look rock solid.
This situation may happen when you are using the Consumption Plan for your Func. This means that after some period of infectivity azure will suspend your Func and when new event or request raised in a system it will reactivate your function. To solve this issue you can do:
More details you can read in this article
You were most likely running into this issue.
The issue is now fixed, but if you were affected, you need to explicitely sync the triggers once now that the fix is out. To do this, go to the Function App in the Portal and click the little refresh icon next to the Function App name in the tree. You just need to do this once.
Then you can leave the portal and it should keep happily running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With