Home

PnP Timerjob - Showing Failing status at azure webjob

Srinivas Narula
Contributor

Hi All,

 

I have used PnPTimerjob Framework  to sync data between two data sources in office365 suite. This job was published to azure webjob and configured to run on recurring basis.

 

Though job is working as expected, but when I checked the azure webjob logs through kudu, status of each job is shown as failed.

 

When I checked the logs, it is failed due to job idle timeout after completing all the steps. 

 

Please let me know if there is any flag/status or some piece which I am missing to make the azure webjob  as completed.

 

Sri

 

 

2 Replies
Highlighted

There is an automatic timeout for timer jobs. Depending on your settings and your code, the following could be the cause (not limited to those, but some bullets to check):

 

  • For long running jobs, Azure web job will be termined prematurly. In that case, you should enable Always On (available from pricing Basic tier 1)
  • For triggered jobs, you have to explicitly terminate your job, otherwise Azure will terminite it for you with a timeout exception - for example Environment.Exit(0), you can also register that the job failed by calling Environment.Exit(1)

 

Also, here is a more proper way of writing the code - that way it will call your function and then end, not run continously and register a timeout exception:

 

 static void Main(string[] args)
  {
    JobHost host = new JobHost();
    host.Call(typeof(Program).GetMethod("RunTask"));
  }

  [NoAutomaticTrigger]
  public static void RunTask()
  {
    Console.WriteLine("Creating queue message: ", message);
  }
Highlighted
@Kiril Iliev

Thanks. I did samething in my application. Looks like there is an issue with the timerjob related webapplication. I will check the same application in other tenant to confirm it.