Merge pull request #1254 from jgehrcke/jp/exclog

Do not swallow exception raised during worker exit
This commit is contained in:
Benoit Chesneau 2016-05-11 21:58:06 +02:00
commit 081f8eec08
3 changed files with 6 additions and 3 deletions

3
THANKS
View File

@ -160,4 +160,5 @@ Hebert J <hebert@mail.ru>
Kevin Littlejohn <kevin@littlejohn.id.au> Kevin Littlejohn <kevin@littlejohn.id.au>
Wolfgang Schnerring <wosc@wosc.de> Wolfgang Schnerring <wosc@wosc.de>
Jason Madden <jason@nextthought.com> Jason Madden <jason@nextthought.com>
Eugene Obukhov <irvind25@gmail.com> Eugene Obukhov <irvind25@gmail.com>
Jan-Philip Gehrcke <jgehrcke@googlemail.com>

View File

@ -856,7 +856,7 @@ worker_exit
def worker_exit(server, worker): def worker_exit(server, worker):
pass pass
Called just after a worker has been exited. Called in the worker, right before it terminates.
The callable needs to accept two instance variables for the Arbiter and The callable needs to accept two instance variables for the Arbiter and
the just-exited Worker. the just-exited Worker.

View File

@ -11,6 +11,7 @@ import select
import signal import signal
import sys import sys
import time import time
import traceback
from gunicorn.errors import HaltServer, AppImportError from gunicorn.errors import HaltServer, AppImportError
from gunicorn.pidfile import Pidfile from gunicorn.pidfile import Pidfile
@ -535,7 +536,8 @@ class Arbiter(object):
worker.tmp.close() worker.tmp.close()
self.cfg.worker_exit(self, worker) self.cfg.worker_exit(self, worker)
except: except:
pass self.log.warning("Exception during worker exit:\n%s",
traceback.format_exc())
def spawn_workers(self): def spawn_workers(self):
"""\ """\