Azure function with Timer Trigger firing twice

MatheusNani 16 Reputation points
2022-12-13T23:01:18.76+00:00

Hi, I have a duplicated email problem and I believe that it's related to my Time Tigger Function firing twice.
Bellow we can see that the function triggers twice with 1 second apart from each run. But the schedule time is set to 10 minutes.

Do you guys have any idea what is wrong or how I can prevent this behavior to happen, please?

Thank you!

270272-203113446-8519bf0b-3651-49c0-a71a-ccd7eb337b04.png

270177-screenshot-1.png

270160-screenshot-2.png

270169-screenshot-3.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,907 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,221 Reputation points
    2022-12-15T10:39:10.407+00:00

    @MatheusNani Thanks for reaching out. There could be different reasons for this issue, and one of the reasons documented here. I will suggest you to review the document below to troubleshoot the issue and see if you are able to find the root cause.

    Timer triggered function app uses TimerTriggerAttribute. This attribute consists of the Singleton Lock feature which ensures that only a single instance of the function is running at any given time. If any process runs longer than the scheduled timer, the new incoming process waits for the older process to finish and then uses the same instance. If you are using the same storage account across different timer trigger functions then this could be one of the reasons as mentioned here.
    You can disable that behavior if you wish by setting UseMonitor = false on your TimerTrigger attribute and see if resolves the issue.

    You can also run the Diagnose and solve problems on your function app and search for "Timer Trigger Issue Analysis" to get the insights and recommendation.

    The other reason could be a restart and I will suggest you to check the Web App Restart detection section.
    https://github.com/Azure/azure-functions-host/wiki/Investigating-and-reporting-issues-with-timer-triggered-functions-not-firing
    https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/TimerTrigger#troubleshooting


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.