2
votes

I have this Azure App where I am hosting a Webjob.

Whenever I start the app, it runs fine with just 1 Webjob and everything works fine. But as time goes by, out of nowhere, there appears another webjob which is the exact copy of the required webjob.

So the problem is that another webjob (unwanted) is spawned when this functionality is not coded in.

Please see Pic 1 (Required/ As is on Start):

Please see Pic 1 (Required/ As is on Start)

Please see Pic 2 (Unwanted/ Happens After some time):

Please see Pic 2 (Unwanted/ Happens After some time)

This is a triggered webjob with a cron schedule of * * * * * *.

1
please share what's written in the web job, that would help figure out possible troubles!Sunny Sharma
Its a similar question to this : stackoverflow.com/questions/49904159/…Umair Ahsan

1 Answers

0
votes

So the problem is that another webjob (unwanted) is spawned when this functionality is not coded in.

I assume that your situation is resulted from the period of execution time. Please check below statement in the doc:

In Azure environment, the scheduled webjob will only run on one instance (or worker). This is achieved by using file lock mechanism while the webjob is running. If the webjob happens to run for a very short time, there could be a race condition (such as clock sku) to cause another instance to later start up on the same schedule (since it detects no lock). The workaround is to make sure the webjob run for a certain period of time (say at least 5 seconds assuming schedule interval is greater).

Also, there is a similar case for your reference: Does Azure start up another instance of a scheduled web job if it is already running?