mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add additional logs when worker exits abnormally
This commit is contained in:
parent
b3f9815aba
commit
28df9926d7
@ -527,6 +527,27 @@ class Arbiter(object):
|
|||||||
reason = "App failed to load."
|
reason = "App failed to load."
|
||||||
raise HaltServer(reason, self.APP_LOAD_ERROR)
|
raise HaltServer(reason, self.APP_LOAD_ERROR)
|
||||||
|
|
||||||
|
if exitcode > 0:
|
||||||
|
# If the exit code of the worker is greater than 0,
|
||||||
|
# let the user know.
|
||||||
|
self.log.error("Worker (pid:%s) exited with code %s.",
|
||||||
|
wpid, exitcode)
|
||||||
|
elif status > 0:
|
||||||
|
# If the exit code of the worker is 0 and the status
|
||||||
|
# is greater than 0, then it was most likely killed
|
||||||
|
# via a signal.
|
||||||
|
try:
|
||||||
|
sig_name = signal.Signals(status).name
|
||||||
|
except ValueError:
|
||||||
|
sig_name = "code %s".format(status)
|
||||||
|
msg = "Worker (pid:{}) was sent {}!".format(
|
||||||
|
wpid, sig_name)
|
||||||
|
|
||||||
|
# Additional hint for SIGKILL
|
||||||
|
if status == signal.SIGKILL:
|
||||||
|
msg += " Perhaps out of memory?"
|
||||||
|
self.log.error(msg)
|
||||||
|
|
||||||
worker = self.WORKERS.pop(wpid, None)
|
worker = self.WORKERS.pop(wpid, None)
|
||||||
if not worker:
|
if not worker:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user