28

We've deployed an on demand Azure webjob and it is in an endless loop. We figured out the bug, did a redeploy and that failed. So we deleted the old job and went to deploy it again but now the job won't start. There is a file called triggeredJob.lock that I've tried to delete but it is in use and I believe that is what's causing the conflict.

Is there a way to recycle the whole app to get this to stop and release the files?

Jon Leach
  • 821
  • 2
  • 10
  • 21

5 Answers5

52

Two solutions:

The simplest is to just hit the Restart button in the Azure portal for the Web App that hosts your WebJob, giving a clean start to all processes.

The more complex but less heavy weight is to go to your Web App's Kudu Console. From there, click on the Process Explorer tab. Find the relevant WebJob process in the list, right click it and choose Kill.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • One thing to be careful about when using the restart button, it clears all jobs and you need to re-deploy. – Mostafa Mar 30 '16 at 14:36
  • 6
    @Mostafa that is not correct. Restarting does not clear any files. If you're running into an issue, I suggestion asking a separate question. Thanks! – David Ebbo Mar 30 '16 at 19:45
  • This is what i have seen, so it is worth sharing :) will double check maybe it was a random behavior. – Mostafa Mar 31 '16 at 13:51
  • 1
    I agree with @DavidEbbo, restarting my web app aborted the web jobs as desired but did not cause them to be lost or need to be re-deployed. I did notice a couple minutes lag before the WebJobs were back online and queryable. – Steve Cadwallader Jun 29 '16 at 20:12
  • thanks buddy I toke the seccond road, just fenomenal! – Pedro Emilio Borrego Rached Nov 25 '16 at 18:43
  • My WebJob is running but I only see `w3wp.exe` and `w3wp.exe scm`... any ideas? – Ohad Schneider Nov 12 '17 at 11:41
  • @OhadSchneider triggered or continuous? Does your plan have several instances? And how do you know it's running? – David Ebbo Nov 12 '17 at 15:00
  • Triggered. My plan is Basic: 2 Small (so two instances). Both the portal and the WebJob log page (https://howlongtobeatsteam.scm.azurewebsites.net/azurejobs/#/jobs) say it's running. – Ohad Schneider Nov 12 '17 at 15:08
  • @OhadSchneider them it's probably running in the other instance. Try process explorer in portal (instead of Kudu). You should see both instances listed there, and hopefully you'll see the rogue process. – David Ebbo Nov 12 '17 at 15:12
  • Nice. Didn't know about that portal Process Explorer. Indeed I can see my WebJob process there, and clicking it I get to pane where I can kill it. – Ohad Schneider Nov 12 '17 at 15:18
  • The better answer is the one by BHUVANESH MOHANKUMAR with detailed info on how to use Kudo and the process explorer to kill the specific webjob. – AH. Jan 26 '18 at 08:22
29

Here are the steps to Kill a Web Jobs in Azure,

Kudu is the Tool in Azure to check Background process.

Kudu URL Format: yourWebSite.scm.azurewebsites.net

Sample URL: google.scm.azurewebsites.net

Login to KUDU web site portal

In Kudu - Select the Process option Menu option

Select on Web Jobs – that suppose to be killed [Properties]

Use Kill Option below, drag down to see the "KILL" button

Click on button "KILL", Killing of Process – Indicated [Red Color]

Once Process Killed Successfully, it will not be displayed.

How ever the webjobs will be in Failed state.

enter image description here

BHUVANESH MOHANKUMAR
  • 2,747
  • 1
  • 33
  • 33
4

Open App Service Configuration, create a WEBJOBS_STOPPED entry and set its value to 1 or 0. I think this is the easiest way!

rGiosa
  • 355
  • 1
  • 4
  • 16
1

Hope your issue resolved. In case if you stooped webjob and still looks like getting desired output. For eg one webjob wrote to send emails after 1 hrs daily. But after stopped it still sending emails. So if this is PRODUCTION it is not good practice to restart application. You can do one thing go to app setting and keep always on setting to OFF. This will remove unnecessary running process for same webjob.

Hope this help

Regards Kunal

Kunal
  • 77
  • 12
0

You have to do a few steps before you can remove the "triggeredJob.lock" file that keeps your job locked. First, you have to stop both the App Service and the SCM and for this. In order to close the SCM you have to find your web job on https://resources.azure.com/ (expand Subscriptions-> resourceGroups-> providers-> Microsoft.Web-> sites-> ...) and edit the "scmSiteAlsoStopped" property into "true".

Once both the App Service and SCM are stopped, you can use an FTP client to remove the "triggeredJob.lock" file from your server. After this, you need to start the App Service again.

You can find more details about how you can remove the "triggeredJob.lock" file here.

Popa Andrei
  • 2,299
  • 21
  • 25