question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebJobs Shutdown signal not working

See original GitHub issue

WebJobsShutdownWatcher is designed to monitor a sentinel file that the Kudu continuous webjobs infrastructure uses to signal that the WebJob is shutting down. In v2 this shutdown signal would cause RunAndBlock to complete, code here stopping the WebJob exe and allowing any cleanup code to run.

In v3, we’re not honoring this - causing a shutdown signal that is picked up by the WebJobsShutdownWatcher does not cause the await host.RunAsync() to complete, allowing any subsequent cleanup code to run. While we do handle the shutdown file notification and trigger token cancellation, it appears that currently this shutdown doesn’t cause IHostedService.StopAsync to be called, meaning any hosted service registered by the SDK or users are not stopped. Likely WebJobsShutdownWatcher needs to use IHostLifetime to call StopAsync when triggered.

We shouldn’t be ignoring the shutdown signal - it’s part of graceful shutdown. As it is now the WebJob will continue running until Kudu kills the process.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mathewccommented, Jun 10, 2021

Fix is checked in (see https://github.com/Azure/azure-webjobs-sdk/commit/01786831f084c5e7a5afb4301464e2d91bfe17af). Will be in the next package release.

2reactions
joshidpcommented, Oct 21, 2020

Any update, please?

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Triggered Webjob - Detecting when webjob stops
Is it a good idea to create a custom trigger (StopTrigger) that used the WebJobsShutdownWatcher class to fire action before the webjob stops...
Read more >
WebJobs Graceful Shutdown - Blog.Amit Apple
For triggered WebJobs there is no shutdown notification but there is a graceful period (30 seconds by default) where the WebJob will not...
Read more >
Azure WebJob sudden shutdown while processing
I'm wondering what if for some reason the WebJob has stopped working while it was processing a queue trigger. Firstly, if the WebJob...
Read more >
Code I wrote: Easy shutdown detection for Azure WebJobs
I've created a libary that provides shutdown detection for Azure WebJobs. It's both for continuous services and finite duration method calls ...
Read more >
Shutdown Signal not working, only Save State and Power Off
Running Windows 10 guest on Catalina. On 4th (I think) installation because of repeated dead-end failures resulting in freezing on startup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found