From 40232284934c32939c0e4e78caad1987c3773e08 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 7 Dec 2023 15:36:28 +0100 Subject: [PATCH] let's exception not bubble ensure we can catch correctly exceptions based on BaseException. Note: patch was origninally proposed by the pr #2923, but original author closed it. Fix #2923 --- gunicorn/workers/base_async.py | 2 +- gunicorn/workers/sync.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/workers/base_async.py b/gunicorn/workers/base_async.py index b059a7cb5..6a79d7ed0 100644 --- a/gunicorn/workers/base_async.py +++ b/gunicorn/workers/base_async.py @@ -82,7 +82,7 @@ def handle(self, listener, client, addr): self.log.debug("Ignoring socket not connected") else: self.log.debug("Ignoring EPIPE") - except Exception as e: + except BaseException as e: self.handle_error(req, client, addr, e) finally: util.close(client) diff --git a/gunicorn/workers/sync.py b/gunicorn/workers/sync.py index 39a209f06..ddcd77270 100644 --- a/gunicorn/workers/sync.py +++ b/gunicorn/workers/sync.py @@ -154,7 +154,7 @@ def handle(self, listener, client, addr): self.log.debug("Ignoring socket not connected") else: self.log.debug("Ignoring EPIPE") - except Exception as e: + except BaseException as e: self.handle_error(req, client, addr, e) finally: util.close(client)