Search code examples
c#azureasp.net-corekuduwebjob

Azure webjob logs Aborted in Kudu even though keeps running


I have a long-running triggered webjob hosted on Azure that runs once per day. In most cases it is processed successfully with running time of about an hour, but from time to time I get Aborted status in Kudu with running time of "less than 1ms". The job actually keeps running, as I can see AppInsights traces appear, but for some reason Kudu immediately marks it Aborted.

Always On is set to true in Service App settings, and it hosts many other jobs that don't suffer from such an issue.

Could you please explain what can be a reason of this behavior and how can I fix this issue?


Solution

  • If you already enable the always on, It maybe because the long-running job might be running in the background, butt SCM does not know it.

    So in this case, you could set WEBJOBS_IDLE_TIMEOUT(mostly this is enough) and/or SCM_COMMAND_IDLE_TIMEOUT(simply set both of them) on a high value under the configure in your app service. This is the time in seconds until Kudu will kill a WebJob that hasn't had any requests or output in the given time period. You could refer to this doc.