I have an Azure WebJob that fails after only 20 minutes of running with the following log output:
[02/27/2015 00:30:11 > 3e9b72: SYS INFO] Status changed to Initializing
[02/27/2015 00:30:21 > 3e9b72: SYS INFO] Run script 'Namespace.Class.DataProcessor.exe' with script host - 'WindowsScriptHost'
[02/27/2015 00:30:21 > 3e9b72: SYS INFO] Status changed to Running
[02/27/2015 00:30:23 > 3e9b72: INFO] Found the following functions:
[02/27/2015 00:30:23 > 3e9b72: INFO] Namespace.Class.DataProcessor.Functions.ManualTrigger
[02/27/2015 00:30:23 > 3e9b72: INFO] Executing: 'Functions.ManualTrigger' because This was function was programmatically called via the host APIs.
[02/27/2015 00:51:35 > 3e9b72: ERR ] Thread was being aborted.
[02/27/2015 00:51:35 > 3e9b72: SYS INFO] WebJob process was aborted
[02/27/2015 00:51:35 > 3e9b72: SYS INFO] Status changed to Stopped
[02/27/2015 00:51:35 > 3e9b72: SYS INFO] Status changed to Failed
[02/27/2015 00:51:35 > 3e9b72: SYS ERR ] WebJob run failed due to: System.Threading.ThreadAbortException: Thread was being aborted.
at Kudu.Core.Jobs.BaseJobRunner.RunJobInstance(JobBase job, IJobLogger logger, String runId)
at Kudu.Core.Jobs.TriggeredJobRunner.<>c__DisplayClass2.<StartJobRun>b__0(Object _)
It is on schedule to start once a day when the system is quiet and after 20 minutes it fails with that error. This error only happens when the job is triggered automatically by the scheduler. If triggered manually from the Azure WebJob panel under the site there is no error even it it runs for many hours.
The job application outputs a '.' every few steps to keep Azure from thinking that it is idle. I've also configured the following settings on the website where the job runs which prevents it from timing out if it takes a while to respond or output something to the log:
WEBJOBS_IDLE_TIMEOUT = 14400
SCM_COMMAND_IDLE_TIMEOUT = 14400
The job action is a POST request to trigger the job which I suspect is the same mechanism that starts the job manually (and doesn't time out).
How can I prevent this from failing after 20 minutes? What setting do I need to change/add to allow the job to run for longer than 20 minutes?