From 8b8c2ea2324df4f44efe41eace147ede5d2f2cf3 Mon Sep 17 00:00:00 2001 From: bingyun <578210452@qq.com> Date: Fri, 3 Jan 2025 15:01:15 +0800 Subject: [PATCH] fix: the worker_abort hook interrupted after executing part --- gunicorn/arbiter.py | 2 +- gunicorn/workers/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 646d684ef..686764e83 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -503,8 +503,8 @@ def murder_workers(self): if not worker.aborted: self.log.critical("WORKER TIMEOUT (pid:%s)", pid) - worker.aborted = True self.kill_worker(pid, signal.SIGABRT) + worker.aborted = True else: self.kill_worker(pid, signal.SIGKILL) diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index 93c465c98..99ce4bab1 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -199,8 +199,8 @@ def handle_quit(self, sig, frame): sys.exit(0) def handle_abort(self, sig, frame): - self.alive = False self.cfg.worker_abort(self) + self.alive = False sys.exit(1) def handle_error(self, req, client, addr, exc):