[.NET 8] BackgroundService stops working after a while
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
It seems that any hosted service inheriting `BackgroundService` seems to stop working after some time. We have a background services that performs work based on data coming through a Channel.
We've created a reproduction that will showcase how the Channel and services are setup.
We've been unable to determine the cause of the background service's death, but it seems to happen as traffic slows down <1 request per day or after a few hours, on the endpoint that creates messages for the channel.
### Expected Behavior
We would expect the background service to stay alive for as long as the application is online and for the worker to continue processing messages.
### Steps To Reproduce
Our application uses Channels to offload work relating to backing up data to Blob Storage and creating a references to the data in our database, which would be much too complex to create a reproduction for.
We have instead created a bare reproduction of how we've setup the channel and background service - with a controller that interacts with the channel to produce messages.
https://github.com/fortress-jp/BSChannelRepro
### Exceptions (if any)
_No response_
### .NET Version
.NET 8 - latest version used by Azure App Service.
### Anything else?
Our application is hosted as an Azure App Service running on 32-bit Windows.
Contributor guide
Assessment
This issue has not been assessed yet.