Dedicated Server does not save world on SIGTERM
Currently, dedicated server process (at least on linux) just terminates immediately when sent a SIGTERM. It only saves and shuts down cleanly on SIGINT (i.e. ctrl+c in console).
This leaves a swath of circumstances where the the process being asked nicely to terminate will just immediately exit, without saving, including but not limited to: user gently terminating processes, computer rebooting, etc.
This can results in progress rolling back unexpectedly to whenever the server last saved, or even possibly corrupt files.
Server should definitely also trap SIGTERM to save and shutdown cleanly.
Comments: 2
-
28 Feb, '21
MrX2000I agree, this should be implemented.
For example systemd defaults to SIGTERM and this cannot be easily changed per service unit (as far as I know).
Currently we have to send SIGINT via separate shutdown script and sleep N amount of time to make sure the server stops gracefully (server does some work before it stops).
This is suboptimal and makes the shutdown procedure asynchronous. There is no simple way to determine when the server has actually stopped after sending SIGINT so to be on the safer side we have to sleep longer than actually necessary.
ps. Has anyone come up with better solutions when using systemd? -
28 Feb, '21
MrX2000I have to correct myself here.
Apparently you can just add "KillSignal=SIGINT" to service unit "[Service]" section and it seems to work as expected.
Systemd documentation leaves a lot to be desired and could use some improvements and clarifications.
But anyway, I still think graceful exiting with SIGTERM should be respected.