MCPcopy
hub / github.com/benoitc/gunicorn / murder_workers

Method murder_workers

gunicorn/dirty/arbiter.py:1047–1064  ·  view source on GitHub ↗

Kill workers that have timed out.

(self)

Source from the content-addressed store, hash-verified

1045 pass
1046
1047 async def murder_workers(self):
1048 """Kill workers that have timed out."""
1049 if not self.cfg.dirty_timeout:
1050 return
1051
1052 for pid, worker in list(self.workers.items()):
1053 try:
1054 if time.monotonic() - worker.tmp.last_update() <= self.cfg.dirty_timeout:
1055 continue
1056 except (OSError, ValueError):
1057 continue
1058
1059 if not worker.aborted:
1060 self.log.critical("DIRTY WORKER TIMEOUT (pid:%s)", pid)
1061 worker.aborted = True
1062 self.kill_worker(pid, signal.SIGABRT)
1063 else:
1064 self.kill_worker(pid, signal.SIGKILL)
1065
1066 def reap_workers(self):
1067 """Reap dead worker processes."""

Callers 2

_worker_monitorMethod · 0.95

Calls 4

kill_workerMethod · 0.95
itemsMethod · 0.80
last_updateMethod · 0.80
criticalMethod · 0.45

Tested by 1