azure-functions-host: Timer trigger does not fire for isolated .NET 7 function app
I have a timer triggered function with a cron schedule of every weekday at 3:30AM UTC “0 30 3 * * Mon-Fri”. The functions host correctly determines when the next executions will be, and the function runs correctly. But it has missed the scheduled invocation time several times lately. It will not run until I go into the Azure Portal and restart the function app, or click around in the menus for a while.
From browsing other issues on this repo, it seems like some other process is not waking the function in time for it to notice that it has an invocation coming up soon, or however that works.
I have researched other relevant issues on this repo. One past issue seemed to be with using the 5-point cron syntax instead of the 6-point syntax for seconds, however that issue has long since been fixed (the issue is closed) and I am using the 6-point syntax anyway. Other issues have mentioned that function apps running on non-Dynamic skus need to have the Always On setting enabled, but my function is running on a Y1 sku and thus is dynamic, so the Always On setting doesn’t apply.
I found this page: https://github.com/Azure/azure-functions-host/wiki/Investigating-and-reporting-issues-with-timer-triggered-functions-not-firing.
It mentions checking the deployment method. Here is the deployment command used: az functionapp deployment source config-zip --resource-group "$(FUNC_RESOURCE_GROUP_NAME)" --name "$(FUNC_APP_NAME)" --src "$(Pipeline.Workspace)/func/spnsecretrotation.zip". I am pretty sure that is using the kudu zipdeploy API, since the page for it mentions that: https://learn.microsoft.com/en-us/cli/azure/functionapp/deployment/source?view=azure-cli-latest#az-functionapp-deployment-source-config-zip but let me know if that’s not correct. UPDATE: looks like yes it is: https://github.com/Azure/azure-cli/blob/6583e8b1b6cf7ad243125960843498245699c95f/src/azure-cli/azure/cli/command_modules/appservice/custom.py#L597C1-L597C1
The only other thing I can think of is that this is using the isolated model on .NET 7, and this page https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/TimerTrigger#scheduling says that an in process timer is created. Does that imply that it cannot or will not wake functions that are running in the isolated model? I can’t find that explicitly stated anywhere.
Investigative information
Please provide the following:
- Function App version: 4.24.4.4, .NET 7.0 Isolated
- Function App name:
func-spnsecretrotation-dev-01 - Function name(s) (as appropriate):
SecretRotationTimerTrigger - Invocation ID: 26aa9a40-bd88-4d2c-966d-58494dd53bb5
- Region: East US 2
Repro steps
See above.
Expected behavior
The function app timer trigger should trigger on the schedule it is given.
Actual behavior
Timer trigger does not trigger until I restart the function app or click around in the portal, at which point it triggers with an invocation reason of Past Due.
Related information
Relevant code from function app:
[Function("SecretRotationTimerTrigger")]
public async Task Run([TimerTrigger("%SecretRotationSchedule%")] TimerInfo myTimer)
The SecretRotationSchedule env var is populated:
App Insights logs confirm that the cron schedule is being parsed correctly:
However, all invocations only occur when I restart the function app or click around in the menus for a while, and have the IsPastDue invocation reason shown:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (1 by maintainers)
Thanks for reporting will check and update