From 5e99d19165ac2d032f49d3a5a4ba14b31e581839 Mon Sep 17 00:00:00 2001 From: Smittix Date: Mon, 2 Mar 2026 10:39:52 +0000 Subject: [PATCH] fix: suppress noisy SSL handshake errors in gunicorn logs Add SSLZeroReturnError and SSLError to gevent's NOT_ERROR list so dropped TLS handshakes (browser preflight, plain HTTP to HTTPS port) don't print scary tracebacks to the console. Co-Authored-By: Claude Opus 4.6 --- gunicorn.conf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gunicorn.conf.py b/gunicorn.conf.py index dae09bd..81edf93 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -10,9 +10,12 @@ def post_worker_init(worker): silences this harmless noise. """ try: + import ssl from gevent import get_hub hub = get_hub() - if SystemExit not in hub.NOT_ERROR: - hub.NOT_ERROR = hub.NOT_ERROR + (SystemExit,) + suppress = (SystemExit, ssl.SSLZeroReturnError, ssl.SSLError) + for exc in suppress: + if exc not in hub.NOT_ERROR: + hub.NOT_ERROR = hub.NOT_ERROR + (exc,) except Exception: pass