我完成了 mod_wsgi 的故障排除,但找不到针对我的分段错误案例的答案。mod_wsgi
当模块集成到我的 Apache httpd 服务器中时,我得到以下 coredump 。服务器没有mod_wsgi
运行良好。
- 阿帕奇 httpd: 2.2.22
- mod_wsgi:3.3
- 蟒蛇:2.6.7
知道是什么导致了核心转储吗?有没有我可以尝试的事情或解决方法?
核心转储:
Program terminated with signal 11, Segmentation fault.
#0 0x00007fe06c39d206 in wsgi_python_init () from /remote/projects1/pdrtke/install/httpd-2.2.22/modules/mod_wsgi.so
#1 0x00007fe06c3aadb5 in wsgi_hook_child_init () from /remote/projects1/pdrtke/install/httpd-2.2.22/modules/mod_wsgi.so
#2 0x00000000004424db in ap_run_child_init ()
#3 0x000000000047ea35 in child_main ()
#4 0x000000000047ef26 in make_child ()
#5 0x000000000047f198 in perform_idle_server_maintenance ()
#6 0x000000000047f67b in ap_mpm_run ()
#7 0x0000000000429361 in main ()
httpd
从源代码编译的二进制文件。(我跑了configure --prefix=...
,仅此而已)
> file httpd
httpd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
> ldd httpd
linux-vdso.so.1 => (0x00007fffdc5ff000)
libm.so.6 => /lib64/libm.so.6 (0x00007f33ef7fe000)
libaprutil-1.so.0 => /remote/projects1/pdrtke/install/httpd-2.2.22/lib/libaprutil-1.so.0 (0x00007f33ef5d4000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f33ef3aa000)
libapr-1.so.0 => /remote/projects1/pdrtke/install/httpd-2.2.22/lib/libapr-1.so.0 (0x00007f33ef172000)
librt.so.1 => /lib64/librt.so.1 (0x00007f33eef69000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f33eed2e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f33eeb11000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f33ee90d000)
libc.so.6 => /lib64/libc.so.6 (0x00007f33ee5af000)
/lib64/ld-linux-x86-64.so.2 (0x00007f33efa54000)
模块 WSGI:
> file mod_wsgi.so
mod_wsgi.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
> ldd mod_wsgi.so
linux-vdso.so.1 => (0x00007fffb8f0e000)
libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007f4c6dd87000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4c6db69000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f4c6d965000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f4c6d762000)
libm.so.6 => /lib64/libm.so.6 (0x00007f4c6d50b000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4c6d1ad000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4c6e37b000)
Python 可执行文件:
> file python
python: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped
> ldd python
linux-vdso.so.1 => (0x00007fff6a1ff000)
libpython2.6.so.1.0 => /softntools/opt/Python-2.6/bin/../lib/libpython2.6.so.1.0 (0x00007f14730fc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1472edf000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f1472cdb000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f1472ad8000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1472882000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1472524000)
/lib64/ld-linux-x86-64.so.2 (0x00007f14733b0000)
事实上,我们发现了问题,这是一个依赖问题:
mod_wsgi.so
使用了特定版本的libpython2.6.so.1.0
与
libpython2.6.so.1.0
python 二进制文件本身使用的不同。尽管这些文件名相同,但这些文件的大小不同
给了 3710590 字节
我为解决这个问题所做的是通过将 LD_RUN_PATH 变量更改为指向来重新编译 mod_wsgi,
/softntools/opt/Python-2.6/lib/
现在它可以工作了。使用调试符号重建所有内容并获得更好的回溯。显然某处存在错误,但如果没有适当的回溯,你真的没有希望找到它,甚至没有希望让别人为你修复它(除非你真的很幸运并且最近遇到完全相同的问题的人发生了可以回答)。