From 436d37c0798cd8c16b921d4fd49da11c2d559551 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Thu, 27 Apr 2017 17:47:08 -0700 Subject: [PATCH] Add the killing of children Kills children processes when parent process receives a signal to shutdown. Solves for #594 --- sanic/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sanic/server.py b/sanic/server.py index 16d300ba..a963c59e 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -502,6 +502,8 @@ def serve_multiple(server_settings, workers): def sig_handler(signal, frame): log.info("Received signal {}. Shutting down.".format( Signals(signal).name)) + for process in processes: + os.kill(process.pid, SIGINT) signal_func(SIGINT, lambda s, f: sig_handler(s, f)) signal_func(SIGTERM, lambda s, f: sig_handler(s, f))