Repository navigation
Handle windows shutdown event - #41101
Conversation
By doing a clean EEShutdown, including calling ProcessExit handlers. This allows ProcessExit to respond to 'docker stop', which sends CTRLSHUTDOWN_EVENT to windows containers. Fixes dotnet#36089
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
|
Actually, this may require more thought for the logoff event. From https://docs.microsoft.com/en-us/windows/console/handlerroutine
I assume that calling |
|
Sounds reasonable. We should make the fix as scoped as possible. |
|
I confirmed that it also works as expected during windows shutdown for a service. |
vitek-karas
left a comment
There was a problem hiding this comment.
Absolutely agree that for .NET 5 we should make this as small of a change as possible.
The logoff scenario is something we may want to look into for .NET 6 (can you please file an issue for it).
|
/backport to release/5.0 |
|
Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/218953220 |
By doing a clean
EEShutdown, including callingProcessExithandlers, as suggested by @stephentoub in #36089 (comment). This allowsProcessExitto respond to 'docker stop', which sendsCTRL_SHUTDOWN_EVENTto windows containers.I'm doing the same for the logoff event.Automated testing is challenging since I don't see a documented way to trigger these events (other than triggering a shutdown or running in a container). I tested this locally to confirm that it produces the desired behavior on 'docker stop', and will do more testing for the
logoff andshutdown events outside of docker.#36089 (comment) suggests removing removing
if (dwCtrlType == CTRL_CLOSE_EVENT). This would causeProcessExitto fire on an unhandled Ctrl+C (currently it does not on windows or unix), so I am making the more targeted change for 5.0.Fixes #36089