I have a function app, that was running once a month on 26th for a few months, but for a business reason we disabled the run. When we turned it back today 14th, it got triggered automatically stating the previous run was missed
Message Trigger Details: UnscheduledInvocationReason: IsPastDue, OriginalSchedule: 2022-05-26T14:05:00.0000000-05:00
Is there any way not to run the previous missed days?
Error "UnscheduledInvocationReason" occurs when either RunOnStartup or isPastDue property is set to true. See code
isPastDue property is set to true when the current function invocation is later than scheduled(for example if a function was restarted) See code
You can set UseMonitor = false to disable "UnscheduledInvocationReason" due to isPastDue.
Azure Function 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. See documentation
https://learn.microsoft.com/en-us/answers/questions/110043/unscheduledinvocationreason-ispastdue-originalsche.html
Related
I have function app where I have one HttpTrigger and 3 BlobTrigger functions. After I deployed it, http trigger is working fine but for others functions which are blob triggers, it gives following errors
"Stopping the listener 'Microsoft.Azure.WebJobs.Host.Blobs.Listeners.BlobListener' for function " for one function
Stopping the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function
" for another two
I verified with other environments and config values are same/similar so not sure why we are getting this issue in one environment only. I am using consumption mode.
Update: When file is placed in a blob function is not getting triggered.
Stopping the listener 'Microsoft.Azure.WebJobs.Host.Blobs.Listeners.BlobListener' for function
I was observed the same message when working on the Azure Functions Queue Trigger:
This message doesn't mean the error in function. Due to timeout of Function activity, this message will appear in the App Insights > Traces.
I have stopped sending the messages in the Queue for some time and has been observed the traces like Web Job Host Stopped and if you run the function again or any continuous activity is present in the Function, then this message will not appear in the traces.
If you are using elastic Premium and has VNET integrated, the non-http trigers needs Runtime scale monitoring enabled.
You can find Function App-->Configuration--> Function runtime settings and turn on Runtime scale monitoring.
If function app and storage account which holds the metadata of the function Private linked, you will need to add the app settings WEBSITE_CONTENTOVERVNET = 1.
Also, make sure you have private linked for blob, file, table and queue on storage account.
I created ticket with MS to fix this issue. After analysis I did some code changes as
Function was async but returning void so changed to return Task.
For the trigger I was using connection string from app settings. But then I changed it to azureWebJobStorage(even though bobth were same) in function trigger attribute param
It started working. So posting here in case it is helpful for others
I have deployed a change to a durable function product into Azure DevOps and part of the work was to rename an activity function.
However the warning below is appearing in the log stream containing the old name for the function.
[Warning] Activity function 'PublishNotification' does not exist..
InstanceId: . Function: PublishNotification.
This function publishes a message to a Service bus topic, and there is definitely now no reference to that function name anywhere in the code.
Any ideas where this might be coming from?
From your description, it seems that your function name has been changed, the orchestrator function listener and other function listeners are been deregistered:
https://github.com/Azure/azure-functions-durable-extension/blob/f6f1dce716b68d8baaa99ed64a9db1306577c58d/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskListener.cs#L44-L54
But the orchestrator function is still running, and it cannot find your previous function name:
https://github.com/Azure/azure-functions-durable-extension/blob/f6f1dce716b68d8baaa99ed64a9db1306577c58d/src/WebJobs.Extensions.DurableTask/DurableOrchestrationContext.cs#L385
If you restart the function app and let everything start again, can you still reproduce this error?
I went into the Azure web job storage queues and had a look around. Turns our there was an old message (about 4 days old) stuck in one of the queues and when that was cleared out the warning messages disappeared too.
I am trying to diagnose this error when my timer function runs. I have not found much help on this on google search
UnscheduledInvocationReason: IsPastDue, OriginalSchedule: 2019-06-13T15:13:00.0000000-07:00
It seems like the process just stops when this error comes.
Anyone have any insight on this?
The IsPastDue flag is passed to your azure function to indicate if the timer was overdue or not. A timer function can run late in some scenarios like the app service was restarted, in this case it is still invoked but the IsPastDue flag will be set to true to give your function a chance to react.
These links are helpful
Timer trigger for Azure Functions
Also, it seems that it was an issue and it is submitted on github but that was on 2017
TimerTrigger can miss IsPastDue
Got this error locally.
[2021-06-16T14:58:22.779Z] Executing 'Functions.TimerTrigger'
(Reason='Timer fired at 2021-06-16T16:58:22.7688953+02:00',
Id=adbaee54-8a3e-4983-a7e4-a73f69153e5e) [2021-06-16T14:58:22.780Z]
Trigger Details: UnscheduledInvocationReason: IsPastDue,
OriginalSchedule: 2021-06-16T16:37:00.0000000+02:00
[2021-06-16T14:59:22.614Z] Starting worker process failed
[2021-06-16T14:59:22.615Z] The operation has timed out.
Solved by clearing Blob Emulator locally:
delete
FROM [AzureStorageEmulatorDb510].[dbo].[Blob]
I have also asked this question in the MSDN Azure forums, but have not received any guidance as to why my function goes idle.
I have an Azure function running on a Consumption plan that goes idle (i.e. does not respond to new messages on the ServiceBus trigger queue) despite following the instructions outlined in this GitHub issue:
The configuration for the function is the following json:
{
"ConnectionStrings": {
"MyConnectionString": "Server=tcp:project.database.windows.net,1433;Database=myDB;User ID=user#project;Password=password;Encrypt=True;Connection Timeout=30;"
},
"Values": {
"serviceBusConnection": "Endpoint=sb://project.servicebus.windows.net/;SharedAccessKeyName=SharedAccessKeyName;SharedAccessKey=KEY_HERE",
}
}
And the function signature is:
public static void ProcessQueue([ServiceBusTrigger("queueName", AccessRights.Listen, Connection = "serviceBusConnection")] ...)
Based on the discussion in the GitHub issue, I believed that having either a serviceBusConnection entry OR an AzureWebJobServiceBus entry should be enough to ensure that the central listener triggers the function when a new message is added to the ServiceBusQueue, but that is proving to not be the case.
Can anyone clarify the difference between how those two settings are used, or notice anything else with the settings I provided that might be causing the function to not properly be triggered after a period of inactivity?
I suggest there are several possible causes for this behavior. I have several Azure subs and only one of them had issues with Storage/Service Bus-based triggers only popping up when app is not idle. So far I have observed that actions listed below will prevent triggers from working correctly:
Creating any Storage-based trigger, deleting (for any reason) the triggering object and re-creating it.
Corrupting azure function input parameters by deleting/altering associated objects without recompiling a function
Restarting functions app when one of the functions fails to compile/bind to trigger OR input parameter and hangs may cause same problems.
It has also been observed that using legacy Connection Strings setting for trigger binding will not work.
Clean deploy of an affected function app will most likely solve the problem if it was caused by any of the actions described above.
EDIT:
It looks like this is also caused by setting Authorization/Authentication on the functions app, but I have not yet figured out if it happens in general or when Auth has specific configuration. Tested on affected Azure sub by disabling auth at all - function going idle after 30-40 mins, queue trigger still initiates an execution, though with a delay as expected. I have found an old bug related to this, but it says issue resolved.
Note: Even though it may seem duplicate, My issue is different and I request you to read complete description before hastily marking the question down just by reading Question title.
I opened "Azure function is not triggering on scheduled time " issue on official "azure-webjobs-sdk-script" git repository on May 24, 2017-but there is no reply yet. So I am re-asking this here.
I am using azure function in consumption plan, and have scheduled it to execute at every 4.00 am utc by setting following cron expression in function.json:
{
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 0 4 * * *"
}
],
"disabled": false
}
Azure function does get execute on time only if I am logged into portal or clicks on function blade. It does not invoke when I am logged out from portal (suggesting either system listener or function go to sleep after some interval).
Their official documentation states that functions in consumption plan do not require any other settings (like Always on) to keep the function alive, instances of the Azure Functions host are dynamically added and removed based on the number of incoming events.. So as per documentation, no other settings I have to configure to execute function in consumption plan.
What I have tried?
From "Timer triggered azure function not getting triggered" question on SO, I re-checked and ensured my plan (consumption plan) and time zone. (I want it to run in utc, so no explicit setting is required)
From "#1445: Azure function timer trigger not firing" git issue, I checked whether it was just logs that are not appearing. But I am certainly sure, that its not the logs but the actual function does not get triggered unless I am having my portal on or trigger it manually.
I tried to check whether this behavior exists if I change the schedule to a more closer recursive invocations--I scheduled function to get executed at every 2 hours, and this schedule perfectly worked even when I logged out or did not awake function manually. This means, there is some issue when schedule is set to run on larger set of intervals (in my case each day)
As discussed here in #1534, deleting and redeploying the function completely in new function app did not reproduce the issue. So deleting the function and/or function app-and redeploying the same should make things working. Meanwhile, Azure team has announced to add internal logging which will help future diagnosis.