user1060500
user1060500

Reputation: 1535

Triggered Web Job Executing Completely, and then Aborting with Timeout 121 seconds later

I have a webjob which is successfully being triggered in Azure when a new item is added to the storage queue.

When it is triggered, I check the logs and all the code written has executed properly, but the web job stays in a "still executing" state, and after 121 seconds after execution it aborts.

Here is the method that gets triggered followed by the log file where you can see "Start Processing Content" is written to the log and "Processing Content Has Completed" was written to the log. That tells me that everything executed fine, and as far as I know there isn't anything else special that I need to do to signal that this was successfully executed.

So, how I think Web Jobs are supposed to work is that this would be considered a successful execution. Instead it is marked as "Failed" in the dashboard and completely stops the web job (even though it is designed to work in continuous mode). Also, App Service is set to Always On.

The recommendations in the error to increase the timeout make no sense. All that would do is instead of timing out 121 seconds after completion, it would timeout 5 mins after completion or whatever I set it to.

It's completely backwards to me that this timeout would abort the job after the job has even indicated it has "Succeeded". (See all the points I bolded the log below for those details). A bug maybe? Or some other missed setting by myself? Or another piece of absent documentation from MS?

App Service Plan is running on a paid service tier (B1).

public static async Task ProcessQueueMessage([QueueTrigger("myTrigger")] CloudQueueMessage message, TextWriter log)
        {
                System.Console.Out.WriteLine($"Start Processing Content");
                await DoSomeWork();
                System.Console.Out.WriteLine($"Processing Content Has Completed");
   }

Upvotes: 1

Views: 1192

Answers (2)

wodzu
wodzu

Reputation: 3172

For those who actually want use to a triggered job, try to replace

host.Run(); by host.Start();

in your Program.cs, it worked for me.

Upvotes: 1

user1060500
user1060500

Reputation: 1535

The solution is to ensure the job is running as a continuous job and not a triggered job.

Upvotes: 1

Related Questions