Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Does Azure WebJob "Pending Restart" Mean?

What does "Pending Restart" mean? I have stopped and restarted my WebJob numerous times and that doesn't seem to fix it. Does it mean I have to restart my website? What caused my job to get in this state in the first place? Is there any way I can prevent this from happening in the future?

like image 269
randomsolutions Avatar asked May 15 '14 20:05

randomsolutions


People also ask

What is a WebJob in Azure?

WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use WebJobs. You can use the Azure WebJobs SDK with WebJobs to simplify many programming tasks.

When would you use a WebJob?

You can use the WebJobs feature of App Service to run a script or code in the context of an App Service web app. The WebJobs SDK is a framework designed for WebJobs that simplifies the code you write to respond to events in Azure services.

How do I deploy Azure WebJob?

Deploy to Azure App ServiceIn Solution Explorer, right-click the project and select Publish. In the Publish dialog box, select Azure for Target, and then select Next. Select Azure WebJobs for Specific target, and then select Next. Above App Service instances select the plus (+) button to Create a new Azure WebJob.

How to restart the current app service in azure webjob?

# # This is a WebJob that restarts the current app service. # # Prerequisites: # # 1. The system assigned managed identity (MSI) must be enabled. # To enable: Azure Portal → this App Service → Identity → Status → On. # # 2. The MSI must be authorized to restart this app service.

Why is my Azure webjob not running?

Stopped - The WebJob was stopped (usually from the Azure portal) and is currently not running and will not be running until it is started again, best way to see this is as disabled. Also, take a look at the webjob log, it should hold cue to what's been happening.

How do I know when a web job is restarting?

Also, take a look at the webjob log, it should hold cue to what's been happening. if the JOB is set to run continuously, once the process exits (say you are polling an queue and it's empty) the job shuts down and status changes to "pending restart". Azure Scheduler will typically restart the process in 60 seconds.

How do I stop or restart a continuous webjob?

To stop or restart a continuous WebJob, right-click the WebJob in the list and select Stop or Start. In the Azure portal, search for and select App Services. Select your web app, API app, or mobile app from the list.


4 Answers

Usually, it means that the job fails to start (an exception?). Look in the jobs dashboard for logs.

Also, make sure that if the job is continuous, you actually have an infinite loop that keeps the process alive.

like image 191
Victor Hurdugaci Avatar answered Oct 12 '22 08:10

Victor Hurdugaci


To add to Victor's answer, the continuous WebJob states are:

  • Initializing - The site was just started and the WebJob is doing it's initialization process.
  • Starting - The WebJob is starting up the process/script.
  • Running - The WebJob's process is running.
  • PendingRestart - The WebJob's process exited (for any good or bad reason) in less than 2 minutes since it started, for a continuous WebJob it's considered that something was probably not right with it (some exception during start-up probably as mentioned by Victor), at this point the system is waiting for 60 seconds before it'll restart the WebJob process (hence the name "pending restart").
  • Stopped - The WebJob was stopped (usually from the Azure portal) and is currently not running and will not be running until it is started again, best way to see this is as disabled.
like image 20
Amit Apple Avatar answered Oct 12 '22 07:10

Amit Apple


Also, take a look at the webjob log, it should hold cue to what's been happening.

if the JOB is set to run continuously, once the process exits (say you are polling a queue and it's empty) the job shuts down and status changes to "pending restart". Azure Scheduler will typically restart the process in 60 seconds.

like image 2
Sameer Vartak Avatar answered Oct 12 '22 08:10

Sameer Vartak


Try changing the target framework to .NET 4.5. This same issue was fixed for me when I changed the target framework from 4.6.1 to 4.5.

like image 1
Arthur Yegiazaryan Avatar answered Oct 12 '22 08:10

Arthur Yegiazaryan