Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.95k stars 442 forks source link

Daily Time trigger functions (v2) not waking up #3076

Closed cyky closed 6 years ago

cyky commented 6 years ago

Daily Time Triggers sleeping

We are having problems with time trigger functions that should execute once a day. Scheduling works fine if the trigger is set to every 5 minutes or 30 minutes, but when the trigger is set to once a day (eg. "0 0 0 *") the functions never wake up and execute their tasks.

Our functions project is using the class lib style project structure and is running on dotnet core 2.0. Schedule has been defined in the function specific function.json file. Project is using Microsoft.NET.Sdk.Functions version 1.0.13 and the functions are running on the latest beta v2 version (West Europe).

Function app version: 2.0.11888.0 (beta) Region: West Europe App service plan: Consumption Invocation ID: d97e01ca-775a-453d-a388-d83beb553a07 Timestamp: 2018-06-29T09:13:59.497

Repro

  1. Create Dotnet Core 2.0 Class Lib Functions project
  2. Add Time trigger function with time trigger that triggers once a day:
{
  "bindings": [
    {
      "authLevel": "function",
      "schedule": "0 0 0 * * *",
      "name": "updateTimer",
      "type": "timerTrigger",
      "direction": "inout"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/Example.Functions.dll",
  "entryPoint": "Example.Functions.BuggyFunction.Run"
}
  1. Wait for function to execute.

Expected results

Function should execute at midnight UTC time.

Actual behavior

Function never executes if the trigger is too far apart.

Related issues

Somewhat similar: https://github.com/Azure/azure-functions-host/issues/2825

mhoeger commented 6 years ago

We have a troubleshooting guide for investigating and reporting issues with timer triggered functions not firing. Would you mind taking a look at it and sharing the details mentioned in "Reporting your issue" section?

cyky commented 6 years ago

Here you go @mhoeger

  1. Function app is running on Consumption plan
  2. Deployment via Kudu Rest zip deployment
  3. We are running v2 preview
  4. Timezone has not been set
  5. CRON is set via functions.json as shown above ( "schedule": "0 0 0 *")
  6. Function leaves no log to application insights (We have event logging via serilog azure app insights extension. It works with other similar functions that use http triggers). Also it hasn't called other function that it should do at least on every Monday.
  7. Invocation ID is shown in the first post.
mhoeger commented 6 years ago

@cyky thank you :) i'll look into this. Just to clarify - by Kudu Rest zip deployment you mean /api/zipdeploy and NOT /api/zip. Is that right?

cyky commented 6 years ago

Yeah I mean the api/zipdeploy. I can get another invocation id for you tomorrow if that helps.

cyky commented 6 years ago

Closing this issue as I think that I've found the cause from our app config. Missing logs from these functions seem to be unrelated problem.