From a8f3e720fd609b7876fe82ae60cc4f6a3477e6a5 Mon Sep 17 00:00:00 2001 From: official-techsupport <98240022+official-techsupport@users.noreply.github.com> Date: Wed, 24 Aug 2022 23:22:54 +0300 Subject: [PATCH] log request info on global timeout (#339) --- gunicorn.conf.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 11280b1e4..ac61df1f8 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -10,7 +10,21 @@ reload = True #print_config = True def worker_abort(worker): + worker.log.warning(f"Worker {worker.pid} received SIGABRT.") + + try: + import flask + r = flask.request + worker.log.warning(f"While serving {r.method} {r.url}") + from files.helpers.wrappers import get_logged_in_user + u = get_logged_in_user() + if u: + worker.log.warning(f"User: {u.username!r} id:{u.id}") + else: + worker.log.warning(f"User: not logged in") + except: + worker.log.warning("No request info") + import os - worker.log.info("Worker %s received SIGABRT." % worker.pid) os.abort()