A timer triggered Azure Webjob running at "B2 Basic" pricing tier is aborted unexpectedly.
[01/09/2018 17:16:03 > 183d71: SYS INFO] Status changed to Running
[01/09/2018 17:16:04 > 183d71: INFO] *** WebJob Main: start ***
[01/09/2018 17:16:06 > 183d71: INFO] Found the following functions:
[01/09/2018 17:16:06 > 183d71: INFO] BB.WebJobs.Functions.ProcessQueueMessage
[01/09/2018 17:16:06 > 183d71: INFO] BB.WebJobs.Functions.DailyWorker
[01/09/2018 17:16:07 > 183d71: INFO] The next 5 occurrences of the schedule will be:
[01/09/2018 17:16:07 > 183d71: INFO] 1/10/2018 12:15:00 AM
[01/09/2018 17:16:07 > 183d71: INFO] 1/11/2018 12:15:00 AM
[01/09/2018 17:16:07 > 183d71: INFO] 1/12/2018 12:15:00 AM
[01/09/2018 17:16:07 > 183d71: INFO] 1/13/2018 12:15:00 AM
[01/09/2018 17:16:07 > 183d71: INFO] 1/14/2018 12:15:00 AM
[01/09/2018 17:16:07 > 183d71: INFO] Job host started
[01/09/2018 18:15:57 > 183d71: SYS INFO] WebJob is still running
[01/10/2018 00:15:00 > 183d71: INFO] Executing 'Functions.DailyWorker' (Reason='Timer fired at 2018-01-10T00:15:00.2773840+00:00', Id=85f5338f-f568-4bec-8eaf-e51fa63dffc0)
[01/10/2018 00:15:00 > 183d71: INFO] DailyWorker started
[01/10/2018 03:05:26 > 183d71: SYS INFO] Status changed to Starting
[01/10/2018 03:05:26 > 183d71: SYS INFO] WebJob singleton setting is False
[01/10/2018 03:05:32 > 183d71: SYS INFO] Run script 'BB.WebJobs.exe' with script host - 'WindowsScriptHost'
[01/10/2018 03:05:32 > 183d71: SYS INFO] Status changed to Running
[01/10/2018 03:05:36 > 183d71: INFO] *** WebJob Main: start ***
[01/10/2018 03:05:39 > 183d71: INFO] Found the following functions:
The same code that accesses a SQL database and request webpages has been running for months on-premises. I am in the process of moving the code to Azure an plans to have it running continuously in a WebJob. The code is kicked off at midnight and executes as expected (verified through database and log-files) until it suddenly is restarted.
This is seen in the log-file above in the line with timestamp: 01/10/2018 03:05:26.
Further inspecting the Kudu trace logs, I found this information:
<step title="Startup Request" date="2018-01-10T03:05:20.437" instance="183d71" url="/" method="GET" type="request" pid="1588,2,8" SCM_SKIP_SSL_VALIDATION="0" ScmType="None" >
<step title="Cleanup Xml Logs" date="2018-01-10T03:05:20.453" /><!-- duration: 15ms -->
</step><!-- duration: 31ms -->
There are no errors in the eventlog.xml file. It simply seems that some Azure monitor decided to kill the process by sending a "Startup Request".
I have had the code running for two nights, and the exact same thing happens, though the time the event occurs is not the same (more than 30 min difference).
Question: is there some CPU usage limit that is hit? I know the process is not using more memory than available, in which case an exception would be caught and logged.
My WebJob is CPU greedy, but to my understanding the CPU is shared with the Web app and it is my responsibility to decide how the resources should be utilised - which I cannot do, when the WebJobs aborts like it does. I plan to have the WebJob running constantly and to wake up at night and work for 5-6 hours until done and then sleep the rest of the day.
I have searched for similar problems and this is not a case of "always on" not being specified nor that someone other than I restarts the Web app.
Any help is much appreciated!!