Skip to content

Commit

Permalink
πŸ› Fix resetting signals in Gunicorn UvicornWorker (#895)
Browse files Browse the repository at this point in the history
* πŸ› Fix resetting signals in Gunicorn UvicornWorker

to fix subprocesses that capture output having an incorrect returncode

* Update uvicorn/workers.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
  • Loading branch information
tiangolo and florimondmanca committed Dec 29, 2020
1 parent 091571b commit 36cfe87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion uvicorn/workers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import logging
import signal

from gunicorn.workers.base import Worker

Expand Down Expand Up @@ -62,7 +63,11 @@ def init_process(self):
super(UvicornWorker, self).init_process()

def init_signals(self):
pass
# Reset signals so Gunicorn doesn't swallow subprocess return codes
# other signals are set up by Server.install_signal_handlers()
# See: https://github.com/encode/uvicorn/issues/894
for s in self.SIGNALS:
signal.signal(s, signal.SIG_DFL)

def run(self):
self.config.app = self.wsgi
Expand Down

0 comments on commit 36cfe87

Please sign in to comment.