执行命令apache2 reload后,Apache2崩溃并出现分段错误

时间:2014-04-21 08:10:21

标签: apache lxml mod-wsgi

我们在Python 2.6的几个应用程序中使用lxml,并且有时,应用程序在分段错误错误后停止响应。 我找到了一种每次都能“触发”问题的方法。如果我使用apache reload命令,则会出现问题。 我已经检查过内存消耗,但是一切看起来都很好。 当我使用apache2 restart重新启动apache时,我没有更多的分段错误错误。 从错误日志中检索到Batcktrace:

Apr 15 15:24:48 server httpd: *** glibc detected *** /usr/sbin/apache2: munmap_chunk(): invalid pointer: 0x00007f6468bf2c00 ***
Apr 15 15:24:48 server httpd: ======= Backtrace: =========
Apr 15 15:24:48 server httpd: /lib/libc.so.6(+0x78bf6)[0x7f64767ecbf6]
Apr 15 15:24:48 server httpd: /usr/lib/libxml2.so.2(xmlCopyError+0xd1)[0x7f6473311801]
Apr 15 15:24:48 server httpd: /usr/lib/libxml2.so.2(__xmlRaiseError+0x30b)[0x7f6473312ecb]
Apr 15 15:24:48 server httpd: /usr/lib/libxml2.so.2(+0x393e5)[0x7f64733173e5]
Apr 15 15:24:48 server httpd: /usr/lib/libxml2.so.2(xmlParseDocument+0x2dc)[0x7f647332e5cc]
Apr 15 15:24:48 server httpd: /usr/lib/libxml2.so.2(+0x50895)[0x7f647332e895]
Apr 15 15:24:48 server httpd: /usr/lib/python2.6/dist-packages/lxml/etree.so(+0x8cbc2)[0x7f645691cbc2]
Apr 15 15:24:48 server httpd: /usr/lib/python2.6/dist-packages/lxml/etree.so(+0x2c7cf)[0x7f64568bc7cf]
Apr 15 15:24:48 server httpd: /usr/lib/python2.6/dist-packages/lxml/etree.so(+0xb9e29)[0x7f6456949e29]
Apr 15 15:24:48 server httpd: /usr/lib/python2.6/dist-packages/lxml/etree.so(+0xba4dd)[0x7f645694a4dd]
Apr 15 15:24:48 server httpd: /usr/lib/python2.6/dist-packages/lxml/etree.so(+0xde1d1)[0x7f645696e1d1]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x51a0)[0x7f646e446350]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x920)[0x7f646e448080]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(+0x7e040)[0x7f646e3ce040]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyObject_Call+0x53)[0x7f646e3a0593]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x3adf)[0x7f646e444c8f]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x920)[0x7f646e448080]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(+0x7e040)[0x7f646e3ce040]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyObject_Call+0x53)[0x7f646e3a0593]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(+0x61fcf)[0x7f646e3b1fcf]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyObject_Call+0x53)[0x7f646e3a0593]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(+0xb69dc)[0x7f646e4069dc]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyObject_Call+0x53)[0x7f646e3a0593]
Apr 15 15:24:48 server httpd: /usr/lib/libpython2.6.so.1.0(PyEval_CallObjectWithKeywords+0x43)[0x7f646e4404b3]
Apr 15 15:24:48 server httpd: /usr/lib/apache2/modules/mod_wsgi.so(+0x12fdb)[0x7f646e813fdb]
Apr 15 15:24:48 server httpd: /usr/lib/apache2/modules/mod_wsgi.so(+0x17eed)[0x7f646e818eed]
Apr 15 15:24:48 server httpd: /usr/lib/libapr-1.so.0(+0x29eb3)[0x7f6476d41eb3]
Apr 15 15:24:48 server httpd: /lib/libpthread.so.0(+0x69ca)[0x7f6476b019ca]
Apr 15 15:24:48 server httpd: /lib/libc.so.6(clone+0x6d)[0x7f647685e1cd]
Apr 15 15:24:48 server httpd: ======= Memory map: ========
Apr 15 15:24:48 server httpd: 7f6378d2d000-7f6455c85000 rw-p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f6455c85000-7f6455c86000 ---p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f6455c86000-7f6456486000 rwxp 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f6456486000-7f6456489000 r-xp 00000000 08:03 792872                     /usr/lib/python2.6/lib-dynload/_bytesio.so
Apr 15 15:24:48 server httpd: 7f6456489000-7f6456689000 ---p 00003000 08:03 792872                     /usr/lib/python2.6/lib-dynload/_bytesio.so
Apr 15 15:24:48 server httpd: 7f6456689000-7f645668a000 r--p 00003000 08:03 792872                     /usr/lib/python2.6/lib-dynload/_bytesio.so
Apr 15 15:24:48 server httpd: 7f645668a000-7f645668b000 rw-p 00004000 08:03 792872                     /usr/lib/python2.6/lib-dynload/_bytesio.so
Apr 15 15:24:48 server httpd: 7f645668b000-7f645668f000 r-xp 00000000 08:03 792858                     /usr/lib/python2.6/lib-dynload/_fileio.so
Apr 15 15:24:48 server httpd: 7f645668f000-7f645688e000 ---p 00004000 08:03 792858                     /usr/lib/python2.6/lib-dynload/_fileio.so
Apr 15 15:24:48 server httpd: 7f645688e000-7f645688f000 r--p 00003000 08:03 792858                     /usr/lib/python2.6/lib-dynload/_fileio.so


Apr 15 15:24:48 server httpd: 7f64775b1000-7f64775b8000 r--s 00000000 08:03 805537                     /usr/lib/gconv/gconv-modules.cache
Apr 15 15:24:48 server httpd: 7f64775b8000-7f64775ba000 r--p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f64775ba000-7f64775bb000 rw-p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f64775bb000-7f64775bc000 rw-s 00000000 08:03 1442753                    /var/log/apache2/mod_jk.shm.5377 (deleted)
Apr 15 15:24:48 server httpd: 7f64775bc000-7f64775be000 rw-p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f64775be000-7f64775bf000 r--p 0001f000 08:03 8000284                    /lib/ld-2.11.1.so
Apr 15 15:24:48 server httpd: 7f64775bf000-7f64775c0000 rw-p 00020000 08:03 8000284                    /lib/ld-2.11.1.so
Apr 15 15:24:48 server httpd: 7f64775c0000-7f64775c1000 rw-p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f64775c1000-7f647762f000 r-xp 00000000 08:03 787387                     /usr/lib/apache2/mpm-prefork/apache2
Apr 15 15:24:48 server httpd: 7f647782f000-7f6477832000 r--p 0006e000 08:03 787387                     /usr/lib/apache2/mpm-prefork/apache2
Apr 15 15:24:48 server httpd: 7f6477832000-7f6477835000 rw-p 00071000 08:03 787387                     /usr/lib/apache2/mpm-prefork/apache2
Apr 15 15:24:48 server httpd: 7f6477835000-7f6477838000 rw-p 00000000 00:00 0
Apr 15 15:24:48 server httpd: 7f647914c000-7f64796e4000 rw-p 00000000 00:00 0                          [heap]
Apr 15 15:24:48 server httpd: 7fff32855000-7fff32878000 rwxp 00000000 00:00 0                          [stack]
Apr 15 15:24:48 server httpd: 7fff3287e000-7fff3287f000 r-xp 00000000 00:00 0                          [vdso]
Apr 15 15:24:48 server httpd: ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Apr 15 15:24:48 server httpd: [Tue Apr 15 15:24:48 2014] [notice] child pid 6126 exit signal Aborted (6)`  

Library version:
    print("%-20s: %s" % ('Python',           sys.version_info))
Python              : (2, 6, 5, 'final', 0)
    print("%-20s: %s" % ('lxml.etree',       etree.LXML_VERSION))
lxml.etree          : (2, 3, 5, 0)
    print("%-20s: %s" % ('libxml used',      etree.LIBXML_VERSION))
libxml used         : (2, 7, 6)
    print("%-20s: %s" % ('libxml compiled',  etree.LIBXML_COMPILED_VERSION))
libxml compiled     : (2, 7, 6)
    print("%-20s: %s" % ('libxslt used',     etree.LIBXSLT_VERSION))
libxslt used        : (1, 1, 26)
    print("%-20s: %s" % ('libxslt compiled', etree.LIBXSLT_COMPILED_VERSION))
libxslt compiled    : (1, 1, 26)
Apache 2.2.14

您是否有任何想法可以解决重装问题?

此致

1 个答案:

答案 0 :(得分:0)

确保您在主Python解释器上下文中运行Web应用程序,而不是子解释器。众所周知,lxml库无法在子解释器中正常工作,可能导致进程崩溃。