-
Notifications
You must be signed in to change notification settings - Fork 5k
IHostedService.StopAsync not invoked with 8.0-windowsservercore-ltsc2019
image
#115206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for the detailed repro. I was able to reproduce this with the following steps:
I also confirmed this behavior occurs when building the App inside the Dockerfile like so: FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2019 AS build
WORKDIR /source
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish --configuration Debug -o /app
FROM mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019
WORKDIR /app
COPY --from=build /app .
USER ContainerUser
ENTRYPOINT ["dotnet", "Shutdown.dll"] I also tested the following variables:
/cc @jkotas - should we transfer this to the runtime repo for further investigation? |
Transferred to runtime since this might be a bug with |
Thank you too for taking this up too.. |
Tagging subscribers to this area: @dotnet/area-extensions-hosting |
I suspect this is the same Windows Service shutdown bug being discussed in #83093 Can you try the workaround we mention there #83093 (comment) - that can help us understand if this is the same bug. using var registration = PosixSignalRegistration.Create(PosixSignal.SIGTERM, (context) => context.Cancel = true); |
This issue has been marked |
Describe the bug
We are using A .NET 8.0 hosted service application on a windows container based on
mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019
as base.We are getting a weird behavior where the
HostedService.StopAsync
is not invoked on container shut down.The same application is working fine when
`mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-1809' is used.
Which .NET image(s) are you using?
mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019
, `mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-1809'Steps to reproduce
Minimal Repro project in https://github.com/SaurabhSunil/Shutdown
##Steps to Reproduce
Build the shutdown project in Debug mode. This is required as docker file uses ./bin/Debug/net8.0 to copy from.
Build the docker image. For this navigate to the Shutdown project location docker build . -t shutdown-trial
Run a container using the image shutdown-trial
Stop the container after starting
Other information
When does this issue occur?
When using
mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019
Does it occur consistently?
Yes
Do you know of any workarounds?
No
Output of
docker version
Output of
docker info
The text was updated successfully, but these errors were encountered: