WebJobs Shutdown signal not working
See original GitHub issueWebJobsShutdownWatcher 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:
- Created 5 years ago
- Reactions:4
- Comments:16 (1 by maintainers)
Top GitHub Comments
Fix is checked in (see https://github.com/Azure/azure-webjobs-sdk/commit/01786831f084c5e7a5afb4301464e2d91bfe17af). Will be in the next package release.
Any update, please?
Thanks