[enhancement]: graceful shutdown on windows
No existing issues.
- [X] There is no existing issue for my request.
Description
As we now the process kill signal handling in windows is not really implemented and sending SIGTERM will kill the process immediately and no listeners will be called and hence also no log is outputted. But more bad, adapters are also not terminated correctly, like no unload handling can take place.
Why?
To minimize differences between Unix and Windows systems and have a clean state after shutdown of controller on windows.
How?
We would need to look into how users stop iobroker on windows and this needs to send some indication to the controller process that controller should be shutdown gracefully else will be killed after timeout.
We already have a log for this e.g. 2024-05-24 13:46:08.151 - info: host.moritz-ThinkPad-P16-Gen-1 received SIGTERM
Maybe this Issue is only related to windows then, I do not see such a message there. I'll try to find someone who can test independently
Yep, I think because Windows does not support the signal logic, likely also the reason of these already running messages. Has to be like this forever. So controller on Windows systems is likely to be terminated immediately when receiving the signal. But this has to be like this since ever and I am also not sure how the process is normally stopped on windows systems.
https://nodejs.org/api/process.html
OK, then let it keep us as a windows feature request.
Please test: https://forum.iobroker.net/post/1180037
https://github.com/ioBroker/ioBroker/pull/537 merged and published. @mcm1957 Please verify and close issue if solved.