From 19d07bd4af86d6dad71f29bcc5b8e5f97704aef2 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Fri, 23 Jan 2026 11:02:29 +0100 Subject: [PATCH] fix: print exception to stderr on worker boot failure When a worker fails to boot, the exception is now printed to stderr (in addition to being logged), consistent with AppImportError handling. This makes boot failures more visible to users. Closes #2933 --- gunicorn/arbiter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 9b9c8d6d..8e27dca4 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -631,8 +631,10 @@ class Arbiter: print("%s" % e, file=sys.stderr) sys.stderr.flush() sys.exit(self.APP_LOAD_ERROR) - except Exception: + except Exception as e: self.log.exception("Exception in worker process") + print("%s" % e, file=sys.stderr) + sys.stderr.flush() if not worker.booted: sys.exit(self.WORKER_BOOT_ERROR) sys.exit(-1)