ioBroker.js-controller icon indicating copy to clipboard operation
ioBroker.js-controller copied to clipboard

[enhancement]: graceful shutdown on windows

Open mcm1957 opened this issue 1 year ago • 4 comments

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.

mcm1957 avatar May 24 '24 09:05 mcm1957

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

foxriver76 avatar May 24 '24 11:05 foxriver76

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

mcm1957 avatar May 24 '24 11:05 mcm1957

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.

grafik

https://nodejs.org/api/process.html

foxriver76 avatar May 24 '24 11:05 foxriver76

OK, then let it keep us as a windows feature request.

mcm1957 avatar May 24 '24 12:05 mcm1957

Please test: https://forum.iobroker.net/post/1180037

Gaspode69 avatar Jul 13 '24 14:07 Gaspode69

https://github.com/ioBroker/ioBroker/pull/537 merged and published. @mcm1957 Please verify and close issue if solved.

Gaspode69 avatar Aug 10 '24 16:08 Gaspode69