我在Django 2.0
服务器上运行uWSGI 2.0.17
应用python 3.4
和openSUSE Leap 42.3 x86-64
并且工作正常
问题是当尝试使用python requests librarys发送http请求时发生uWSGI分段错误
这是来自uwsgi的日志
2018-04-10 06:46:15,136 | DEBUG | Starting new HTTPS connection (1): www.googleapis.com
!!! uWSGI process 30352 got Segmentation Fault !!!
*** backtrace of 30352 ***
/usr/bin/uwsgi(uwsgi_backtrace+0x2e) [0x46b92e]
/usr/bin/uwsgi(uwsgi_segfault+0x21) [0x46bcc1]
/lib64/libc.so.6(+0x34940) [0x7fb169878940]
/home/pw/venv/lib64/python3.4/lib-dynload/_ssl.cpython-34m.so(+0xb2aa) [0x7fb1661542aa]
/home/pw/venv/lib64/python3.4/lib-dynload/_ssl.cpython-34m.so(+0xcd0f) [0x7fb166155d0f]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x413c) [0x7fb169f1673c]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3fe5) [0x7fb169f165e5]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x2b0) [0x7fb169f1c050]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x2b0) [0x7fb169f1c050]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3fe5) [0x7fb169f165e5]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3fe5) [0x7fb169f165e5]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3fe5) [0x7fb169f165e5]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x2b0) [0x7fb169f1c050]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(+0xd7854) [0x7fb169ef7854]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x2364) [0x7fb169f14964]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3fe5) [0x7fb169f165e5]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3a36) [0x7fb169f16036]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x2b0) [0x7fb169f1c050]
/usr/lib64/libpython3.4m.so.1.0(+0xd75c8) [0x7fb169ef75c8]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(+0xd431a) [0x7fb169ef431a]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(+0x7d09a) [0x7fb169e9d09a]
/usr/lib64/libpython3.4m.so.1.0(PyObject_Call+0x4a) [0x7fb169ef2eca]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x3ea8) [0x7fb169f164a8]
/usr/lib64/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x619) [0x7fb169f1c3b9]
*** end of backtrace ***
DAMN ! worker 2 (pid: 30352) died :( trying respawn ...
Respawned uWSGI worker 2 (new pid: 30481)
这里是myapp.uwsgi.ini
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/pw
# Django's wsgi file
wsgi-file = /home/pw/public/wsgi.py
# the virtualenv (full path)
home = /home/pw/venv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 4
threads = 5
# the socket (use the full path to be safe
socket = /home/pw/pw.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
vacuum = true
,这是引发异常的python代码
def get_account_info(self, id_token):
request_ref = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key={0}".format(self.api_key)
headers = {"content-type": "application/json; charset=UTF-8"}
data = json.dumps({"idToken": id_token})
request_object = requests.post(request_ref, headers=headers, data=data)
raise_detailed_error(request_object)
return request_object.json()
任何想法如何解决?