python-openid导致mod_wsgi上的分段错误

时间:2013-09-21 13:54:46

标签: python django apache mod-wsgi

我正在努力让Facebook登录使用Django。我尝试了Django-allauth和python-social-auth。两者都适用于开发服务器,但不能与mod_wsgi一起使用。

我收到了一个Apache2 500错误页面。

在日志中我遇到如下错误:

[Sat Sep 21 15:30:06 2013] [notice] child pid 27293 exit signal Segmentation fault (11)

[Sat Sep 21 15:30:04 2013] [error] [client 12.23.34.45] Premature end of script headers: wsgi.py
[Sat Sep 21 15:30:04 2013] [error] [client 12.23.34.45] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

当我删除python-openid模块时,everythings工作正常(我得到Django 500错误页面,说这个模块丢失,但wsgi没有段错误)

我在httpd.conf中使用这些wsgi指示:

WSGIDaemonProcess info user=info group=info threads=25
WSGIProcessGroup info

在同一台服务器上,我有许多其他Django网站正在制作中,都没有问题(每个网站都使用了virtualenv)。

我将loglevel设置为debug,这给了我额外的消息:

[Sat Sep 21 15:59:19 2013] [debug] core.c(3126): [client 12.23.34.45] redirected from r->uri = /admin/
[Sat Sep 21 15:59:20 2013] [info] mod_wsgi (pid=28475): Attach interpreter ''.
[Sat Sep 21 15:59:20 2013] [info] mod_wsgi (pid=28475): Create interpreter 'www.mydomein.nl|'.
[Sat Sep 21 15:59:20 2013] [info] [client 12.23.34.45] mod_wsgi (pid=28475, process='info', application='mydomain.nl|'): Loading WSGI script '/home/info/wsgi.py'.

(感谢编辑)

建议我将httpd.conf更改为:

WSGIDaemonProcess info user=info group=info threads=25
WSGIProcessGroup info
WSGIApplicationGroup %{GLOBAL}

不幸的是我仍然遇到同样的问题。

编辑:

mod_wsgi文档建议运行GDB进行调试。我得到了一些信息,但我不理解输出:

#0  0x00007f5aea4db293 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007f5aeae0b370 in apr_poll (aprset=0x7fffb31f7130, num=1, nsds=0x7fffb31f7178, timeout=<value optimized out>) at poll/unix/poll.c:120
#2  0x00007f5ae501d5af in wsgi_daemon_main (p=0x102e138, daemon=0x1093ec0) at mod_wsgi.c:10801
#3  wsgi_start_process (p=0x102e138, daemon=0x1093ec0) at mod_wsgi.c:11269
#4  0x00007f5ae5020351 in wsgi_manage_process (reason=<value optimized out>, data=0x1093ec0, status=<value optimized out>) at mod_wsgi.c:9761
#5  0x00007f5aeae064a1 in apr_proc_other_child_alert (proc=<value optimized out>, reason=<value optimized out>, status=<value optimized out>)
    at misc/unix/otherchild.c:115
#6  0x00000000004bb50f in ap_mpm_run (_pconf=<value optimized out>, plog=<value optimized out>, s=<value optimized out>) at prefork.c:1073
#7  0x000000000042e2b4 in main (argc=4, argv=0x7fffb31f7588) at main.c:753

EDIT2

当回溯时,我看到一些外来线路来了。因此,我检查了两个expat版本:

[root@server info]# strings /etc/httpd/lib/libexpat.so.0 | grep expat_
expat_1.95.7


 pyexpat.version_info
(2, 0, 1)

似乎我的apache安装已经过时了......

1 个答案:

答案 0 :(得分:1)

为什么mod_wsgi可能会崩溃在mod_wsgi的常见问题解答中。

特别是,您可能正在使用C扩展模块,该模块未正确编写以在Python子解释器中工作,因此崩溃。

正如mod_wsgi的问题列表中所解释的那样,假设它是唯一在该mod_wsgi守护程序进程中运行的WSGI应用程序,强制它在主解释器中运行,使用:

WSGIApplicationGroup %{GLOBAL}