Why is gunicorn calling sys.exit(1)?

拈花ヽ惹草 提交于 2020-08-24 05:09:12

问题


Gunicorn is sometimes crashing my server, actually exiting the Python interpreter with sys.exit(1)! Why is this? Note that the failure is not always at the same point. In the two cases shown below, there is a different last codeline before gunicorn's exit. This code running here is openpyxl , which should not be causing interpreter shutdown!

Is the server running out of memory? Some other cause?

(This is Flask on Gunicorn on Docker in Google Container Engine.)

Case 1

  File "/virtualenv_for_docker/lib/python3.7/site-packages/openpyxl/descriptors/base.py", line 166, in __set__
    super(Bool, self).__set__(instance, value)
  File "/virtualenv_for_docker/lib/python3.7/site-packages/gunicorn/workers/base.py", line 196, in handle_abort
    sys.exit(1)
SystemExit: 1

Case 2

  File "/virtualenv_for_docker/lib/python3.7/site-packages/openpyxl/descriptors/serialisable.py", line 164, in __eq__
    def __eq__(self, other):
  File "/virtualenv_for_docker/lib/python3.7/site-packages/gunicorn/workers/base.py", line 196, in handle_abort
    sys.exit(1)
SystemExit: 1

回答1:


As wrote @maxm the server is catching a SIGABRT, that call generally happens on timeout.

You should increase the timeout value or reduce the request processing time. Also you can setup the signal handler to try to log what happened in the worker after a timeout.



来源:https://stackoverflow.com/questions/52993280/why-is-gunicorn-calling-sys-exit1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!