question

SergeyNosov-7268 avatar image
0 Votes"
SergeyNosov-7268 asked MayankBargali-MSFT answered

Timer triggered consumption function with NCRON expression in app settings not executing on-time.

Please help diagnosing the following past due execution. Thank you.

Are you using Consumption or App Service Plan:
Consumption

If Consumption, how did you deploy?
Azure DevOps Release pipeline (Function App on Windows task)

Are you using the v1 runtime, or the v2 (Preview) runtime?
dotnet worker runtime extension version 3

Are you setting WEBSITE_TIME_ZONE?
Yes: Eastern Standard Time

What is your CRON expression set to, and what is your expectation about what it means.
0 0 21 * * * (in application settings)
I expect it to fire every day at 9 PM

Give a specific UTC time at which you expected your function to get called, and found that it wasn't. Also, explain how you are determining that it is not getting called.

1 AM UTC
The function app did not wake up at all until I started interacting with it in the portal.
Trigger Details: UnscheduledInvocationReason: IsPastDue, OriginalSchedule: 2021-07-23T21:00:00.0000000-04:00

include a sample invocation ID so we can find your app and look into the issue
Executing 'allocate-csrs-scheduled' (Reason='Timer fired at 2021-07-23T23:44:32.4963403-04:00', Id=39a84255-5b08-4203-9da2-9a1991e1c490)






azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered

Hi @SergeyNosov-7268

Welcome to Microsoft Q&A! Thanks for posting the question.

As per the code "UnscheduledInvocationReason" occurs when either "RunOnStartup" or "isPastDue" is set to true. Now as per the document here , "isPastDue" property is set to true when the current function invocation is later than scheduled, for example this can happen if a function was restarted. You can find the logical implementation here in the code. You can set "UseMonitor = false" to disable "UnscheduledInvocationReason" due to "isPastDue".

TimerTrigger uses the Singleton feature of WebJobs SDK to ensure that a single instance of a function app is running by acquiring a Blob lease, the log you are observing here is regarding this singleton behavior. Please refer to this document here for more information.

Feel free to get back to me if you have any queries or concerns.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.