From 7d50d61f94507206670d277112d822a6f7fee108 Mon Sep 17 00:00:00 2001 From: laggardkernel Date: Thu, 8 Apr 2021 14:14:45 +0800 Subject: [PATCH] Fix calling condition for Arbiter.log.reopen_files() `GUNICORN_FD` is not always set in a `reexec`ed child process. Considering `Arbiter.master_pid` is set after log reopening, choose `GUNICORN_PID`. --- gunicorn/arbiter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 24ec38744..fff0b7a57 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -93,7 +93,7 @@ def setup(self, app): self.log = self.cfg.logger_class(app.cfg) # reopen files - if 'GUNICORN_FD' in os.environ: + if 'GUNICORN_PID' in os.environ: self.log.reopen_files() self.worker_class = self.cfg.worker_class