script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Feature request: support clean shutdown also on SIGTERM

Open rwalkerands opened this issue 1 year ago • 2 comments

docker/podman stop script-server sends first SIGTERM, then, after a timeout, SIGKILL.

script-server seems to ignore SIGTERM, so docker/podman sends SIGKILL after the timeout.

I see that ./src/web/server.py/intercept_stop_when_running_scripts() configures a handler for SIGINT that will do a clean shutdown as long as there are no currently-running scripts.

Would it be possible to do a clean shutdown on SIGTERM also? It could be like the existing behaviour for SIGINT except (I guess) acting as though the user answered n to the question Do you want to stop server anyway?.

rwalkerands avatar Feb 19 '24 00:02 rwalkerands

Hi @rwalkerands, thanks for reporting. I'm not sure what is the problem. In my understanding, SIGINT is needed for script server only to ask confirmation from a user. If such confirmation is not needed, a signal (SIGTERM) should be propagated to all children processes. So that it's the responsibility of the children processes to handle SIGTERM properly. Could you confirm, that if there are no running scripts, Script server stops on SIGTERM? Or you mean, that even in this case, SIGTERM is ignored?

bugy avatar Feb 20 '24 08:02 bugy

I'm getting this:

$ podman stop script-server
WARN[0010] StopSignal SIGTERM failed to stop container script-server in 10 seconds, resorting to SIGKILL
script-server

rwalkerands avatar Feb 21 '24 00:02 rwalkerands