Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure timer triggered function not invoked. #8649

Open
spmanjunath opened this issue Aug 22, 2022 · 10 comments
Open

Azure timer triggered function not invoked. #8649

spmanjunath opened this issue Aug 22, 2022 · 10 comments
Assignees

Comments

@spmanjunath
Copy link

The Azure Timer Triggered function is not invoked, strangely, refreshing the corresponding Azure function app page in Azure Portal triggers this function.

Investigative information

  • Timestamp: 2022-08-19 12:07:26.403
  • Function App version: v4
  • Function name(s) (as appropriate): AppExpiryNotifier
  • Invocation ID: 34a19bfa-aec6-4faa-b90f-d91d7c6a6177
  • Region: NorthEurope
  • OS: Linux
  • Plan: Consumption

Expected behavior

Azure function should be invoked as per the schedule. Code and configuration extracts are as below,

[Function(nameof(AppExpiryNotifier))]
public async Task Run([TimerTrigger("%NotificationSettings:TimerInterval%")] ScheduleInfo scheduleInfo)
{
    _logger.LogInformation($"Timer trigger function executed at: {DateTime.Now}");

    await _expiryNotificationService.ScanAndNotifyAsync();

    _logger.LogInformation($"Next timer schedule at: {scheduleInfo?.ScheduleStatus?.Next}");
}

image

Actual behavior

Timer function is not triggered.

Known workarounds

  • Refreshing the function app page (browser refresh) in Azure portal will trigger the function.

Related information

  • i have only one timer triggered function in the app - have commented the http triggered function as there were few blogs that attributed mix of timer and http triggers to be the root cause. But, this did not fix the issue.
  • Have tried timer synchronization step as describe here - this did not give permanent solution.
  • Function app is deployed using Azure DevOps using AzureFunctionApp@1 task.
  • No additional configuration related to time zones.

Thanks.

@ghost ghost assigned surgupta-msft Aug 22, 2022
@ramya894 ramya894 self-assigned this Aug 22, 2022
@ramya894
Copy link

@spmanjunath can you provide us the function app name instead of function name so that we can be able to find the logs and provide you with the solution.

@spmanjunath
Copy link
Author

spmanjunath commented Aug 23, 2022

Function app name: eimappregops-func

@ramya894
Copy link

@spmanjunath i went through the logs for the time stamp 2022-08-20 10:30 to 2022-08-23 10:30 and seen some exceptions for the functions as below Host Runtime instance (Dynamic Plan) was not available for a long time period (> 15 minutes)
Function was running on 0 worker instance for more than 1440 minutes between 8/20/2022 10:30:00 AM and 8/21/2022 10:35:00 AM

App Setting : FUNCTIONS_WORKER_RUNTIME conflicts with LinuxFxVersion: FUNCTIONS_WORKER_RUNTIME is set to dotnet-isolated while LinuxFxVersion is configured to DOTNET-ISOLATED|6.0.
Currently, we honor your FUNCTIONS_WORKER_RUNTIME setting and your function app is running on dotnet-isolated

Here is how you can troubleshoot the issue.

https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/TimerTrigger#troubleshooting
Related information:
#7025
Azure/azure-webjobs-sdk-extensions#249
#1864

Alternatively, follow the instructions below.

Navigate to the application in the Azure Portal.
In the left hand side menu click on Activity Log.
Go to App Service Diagnostics

Please check and let us know if this helps.

@spmanjunath
Copy link
Author

@ramya894 : I looked for past 7 days logs in Application insight and there are no errors, please guide me where you noticed these errors, so that i can investigate it further. The primary reason for the function to have long no-run is due to timer trigger not getting invoked - i have only one timer trigger function.


App Setting : FUNCTIONS_WORKER_RUNTIME conflicts with LinuxFxVersion: FUNCTIONS_WORKER_RUNTIME is set to dotnet-isolated while LinuxFxVersion is configured to DOTNET-ISOLATED|6.0.
Currently, we honor your FUNCTIONS_WORKER_RUNTIME setting and your function app is running on dotnet-isolated

I updated LinuxFxVersion configuration as above, the timer trigger function is still not getting invoked. Are there other misconfigurations that results in these type of errors?

Going through the 'Diagnose and solve problems' blade everything seems to be working as expected.

I have explored the links you provided and i don't see any of those could be possible causes? Please note that the timer trigger gets called merely by refreshing the corresponding Function app - browser page. This could be related to Sync trigger issue, but i have tried updating the triggers and is not solving the issue. Kindly let me know what other possible issues could result in this.

@spmanjunath
Copy link
Author

@ramya894 : I wanted to check if the issue is related to use of nested app setting format that is used for trigger binding, the said function is deployed in Linux environment,

App setting is:

{
  "name": "NotificationSettings__TimerInterval",
  "value": "0 45 15 * * 1-5",
  "slotSetting": false
},

In my Azure function, timer trigger is set to %NotificationSettings:TimerInterval%, is this correct?

#[Function(nameof(AppExpiryNotifier))]
public async Task Run([TimerTrigger("%NotificationSettings:TimerInterval%")] ScheduleInfo scheduleInfo)//
{
    _logger.LogInformation($"Timer trigger function executed at: {DateTime.Now}");

    await _expiryNotificationService.ScanAndNotifyAsync();

    _logger.LogInformation($"Next timer schedule at: {scheduleInfo?.ScheduleStatus?.Next}");
}

@spmanjunath
Copy link
Author

It appears that the hierarchical/nested trigger binding causes issues with Azure function, i changed the naming format as below and timer trigger was getting called as expected,

{
  "name": "NotificationSettingsTimerInterval",
  "value": "0 30 04 * * 1-5",
  "slotSetting": false
},

Timer trigger binding without separators %NotificationSettingsTimerInterval%,

[Function(nameof(AppExpiryNotifier))]
public async Task Run([TimerTrigger("%NotificationSettingsTimerInterval%")] ScheduleInfo scheduleInfo)//
{
    _logger.LogInformation($"Timer trigger function executed at: {DateTime.Now}");

    await _expiryNotificationService.ScanAndNotifyAsync();

    _logger.LogInformation($"Next timer schedule at: {scheduleInfo?.ScheduleStatus?.Next}");
}

I guess this is a bug, not sure if it is a problem specific to Linux environment. I would prefer to have this working with nested config references. Please suggest a solution.

@ramya894
Copy link

@spmanjunath we will check this issue with the next level team and let you know the results soon, thank you

@machielvisser
Copy link

Can we get an update on this?

@dfourmanfsquared
Copy link

I'm facing this issue now as well, it's pretty inconsistent, sometimes it'll run on a schedule, sometimes it wont.

@alperenbelgic
Copy link

@spmanjunath we will check this issue with the next level team and let you know the results soon, thank you

have you checked it? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants