Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

psycopg2 - uwsgi segmentation fault when serving a django application

I am trying to migrate a django application from one server to another. The application is working fine on the old server.

On the new server, the application works fine when used using Django's runserver.

To test the django application under uwsgi, I used

uwsgi --http :8000 --module mysite.wsgi

This opens the django admin page as expected but as soon as I try to login, uwsgi gets a segmentation fault error which is as follows.

Would greatly appreciate if anybody could help understand what this means, and how might I fix this.


*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 15398, cores: 1)
!!! uWSGI process 15398 got Segmentation Fault !!!
*** backtrace of 15398 ***
uwsgi(uwsgi_backtrace+0x35) [0x5569e2f17555]
uwsgi(uwsgi_segfault+0x23) [0x5569e2f17903]
/lib/x86_64-linux-gnu/libc.so.6(+0x35fc0) [0x7f0dd221bfc0]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/./libssl-1d6df745.so.1.0.2p(ssl3_cleanup_key_block+0xb) [0x7f0dd0241cab]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/./libssl-1d6df745.so.1.0.2p(ssl3_clear+0x16) [0x7f0dd023f5a6]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/./libssl-1d6df745.so.1.0.2p(tls1_clear+0x9) [0x7f0dd024b219]
/usr/lib/x86_64-linux-gnu/libssl.so.1.1(SSL_new+0x43f) [0x7f0dd2bf376f]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/libpq-3a62a61f.so.5.11(+0x23969) [0x7f0dd04d6969]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/libpq-3a62a61f.so.5.11(+0x24fc5) [0x7f0dd04d7fc5]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/libpq-3a62a61f.so.5.11(PQconnectPoll+0xb78) [0x7f0dd04c1ba8]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/libpq-3a62a61f.so.5.11(+0xfa28) [0x7f0dd04c2a28]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/.libs/libpq-3a62a61f.so.5.11(PQconnectdb+0x1f) [0x7f0dd04c541f]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/_psycopg.cpython-36m-x86_64-linux-gnu.so(+0x12651) [0x7f0dd0716651]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/_psycopg.cpython-36m-x86_64-linux-gnu.so(+0x133df) [0x7f0dd07173df]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x1fcab2) [0x7f0dd25d9ab2]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_FastCallDict+0x89) [0x7f0dd2645e99]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_CallFunction_SizeT+0x124) [0x7f0dd26468b4]
/home/vikas/ssersurvey/env/lib/python3.6/site-packages/psycopg2/_psycopg.cpython-36m-x86_64-linux-gnu.so(+0xc1a8) [0x7f0dd07101a8]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyCFunction_Call+0x96) [0x7f0dd25f0fe6]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x7940) [0x7f0dd2561f10]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17ba3f) [0x7f0dd2558a3f]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyEval_EvalCodeEx+0x3e) [0x7f0dd25594fe]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x23cc63) [0x7f0dd2619c63]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyObject_Call+0x48) [0x7f0dd26466d8]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x3de5) [0x7f0dd255e3b5]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c2eb) [0x7f0dd25592eb]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c2eb) [0x7f0dd25592eb]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c2eb) [0x7f0dd25592eb]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17ba3f) [0x7f0dd2558a3f]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c11e) [0x7f0dd255911e]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c2eb) [0x7f0dd25592eb]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17ba3f) [0x7f0dd2558a3f]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c11e) [0x7f0dd255911e]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x3c95) [0x7f0dd255e265]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x2428a8) [0x7f0dd261f8a8]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x239aa6) [0x7f0dd2616aa6]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x239f6a) [0x7f0dd2616f6a]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x1fcab2) [0x7f0dd25d9ab2]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_FastCallDict+0x89) [0x7f0dd2645e99]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17bee8) [0x7f0dd2558ee8]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c2eb) [0x7f0dd25592eb]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17a8a3) [0x7f0dd25578a3]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyFunction_FastCallDict+0x2c3) [0x7f0dd2558e43]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_FastCallDict+0x131) [0x7f0dd2645f41]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_Call_Prepend+0xcd) [0x7f0dd264666d]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyObject_FastCallDict+0x89) [0x7f0dd2645e99]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x6bb61) [0x7f0dd2448b61]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x1f5f65) [0x7f0dd25d2f65]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x186ff9) [0x7f0dd2563ff9]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyCFunction_FastCallDict+0x13a) [0x7f0dd25f0d6a]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c20c) [0x7f0dd255920c]
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec2) [0x7f0dd255f492]
*** end of backtrace ***
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This error occurs when uwsgi and psycopg are compiled against two different openssl versions. You have two solution.

  • disable ssl of django database configuration (the other answer's solution)
  • Install psyocpg2 from source instead of wheel

to install psyocpg2 from source you have to uninstall previous one and try this

pip uninstall psycopg2
pip install --no-binary :all: psycopg2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...