mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix crashing issue with signals TTIN and TTOU. Also clear out zombie procs left by those signals.
This commit is contained in:
parent
7cf859a5c0
commit
7c30c1e9ae
@ -205,7 +205,8 @@ class Arbiter(object):
|
||||
self.kill_workers(signal.SIGKILL)
|
||||
|
||||
def murder_workers(self):
|
||||
for (pid, worker) in self.WORKERS.iteritems():
|
||||
running_workers = tuple(self.WORKERS.iteritems())
|
||||
for (pid, worker) in running_workers:
|
||||
diff = time.time() - os.fstat(worker.tmp.fileno()).st_mtime
|
||||
if diff < self.timeout:
|
||||
continue
|
||||
@ -267,7 +268,10 @@ class Arbiter(object):
|
||||
def kill_worker(self, pid, sig):
|
||||
worker = self.WORKERS.pop(pid)
|
||||
try:
|
||||
os.kill(pid, sig)
|
||||
os.kill(pid, sig)
|
||||
kpid, stat = os.waitpid(pid, os.WNOHANG)
|
||||
if kpid:
|
||||
log.warning("Problem killing process: %s" % pid)
|
||||
except OSError, e:
|
||||
if e.errno == errno.ESRCH:
|
||||
pass
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user