From d1a09732256fa8db900a1fe75a71466cf2645ef9 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 19 Dec 2014 08:01:18 +0100 Subject: [PATCH] send SIGQUIT/SIGTERM only once to the workers there is no need to send more than once the signal to the workers when exiting. With this patch we are sending once the QUIT/TERM signal and then wait until the graceful timeout or until there are workers alive. fix #655 --- gunicorn/arbiter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index d92444e1..50ae95dd 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -348,9 +348,12 @@ class Arbiter(object): if not graceful: sig = signal.SIGQUIT limit = time.time() + self.cfg.graceful_timeout + # instruct the workers to exit + self.kill_workers(sig) + # wait until the graceful timeout while self.WORKERS and time.time() < limit: - self.kill_workers(sig) time.sleep(0.1) + self.kill_workers(signal.SIGKILL) def reexec(self):