我有一个内部python程序,它附带python解释器和一些库来生产。它在RHEL 6环境中工作正常。
然而,在RHEL 7.4上,它有些如何引发分段错误。 我们怀疑应用程序库libxml2正在覆盖系统库。
Backtrace:
(gdb) backtrace
#0 0x00007ffff7228e00 in __strncmp_sse42 () from /lib64/libc.so.6
#1 0x00007ffff03b3a48 in __xmlParserInputBufferCreateFilename (URI=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml", enc=XML_CHAR_ENCODING_NONE) at xmlIO.c:2476
#2 0x00007ffff038cd44 in xmlNewInputFromFile__internal_alias (ctxt=0xa012a0, filename=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml") at parserInternals.c:1463
#3 0x00007ffff03b59a2 in xmlDefaultExternalEntityLoader (URL=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml", ID=0x0, ctxt=0xa012a0) at xmlIO.c:3832
#4 0x00007ffff085d722 in __pyx_f_4lxml_5etree__local_resolver (__pyx_v_c_url=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml", __pyx_v_c_pubid=0x0, __pyx_v_c_context=0xa012a0)
at src/lxml/lxml.etree.c:63618
#5 0x00007ffff03a4bd0 in xmlCtxtReadFile__internal_alias (ctxt=0xa012a0, filename=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml", encoding=0x0, options=83970) at parser.c:14487
#6 0x00007ffff08754b4 in __pyx_f_4lxml_5etree_11_BaseParser__parseDocFromFile (__pyx_v_self=0x7b6640, __pyx_v_c_filename=0x9c7f3c "/opt/monitor/tools/etc/pmonspec.xml")
at src/lxml/lxml.etree.c:68146
#7 0x00007ffff083316f in __pyx_f_4lxml_5etree__parseDocFromFile (__pyx_v_filename8=0x9c7f18, __pyx_v_parser=0x7b6640) at src/lxml/lxml.etree.c:71175
#8 0x00007ffff0833239 in __pyx_f_4lxml_5etree__parseDocumentFromURL (__pyx_v_url=0x7fffffffda14, __pyx_v_parser=0x7fff00000000) at src/lxml/lxml.etree.c:72080
#9 0x00007ffff0885768 in __pyx_f_4lxml_5etree__parseDocument (__pyx_v_source=0x9c7f18, __pyx_v_parser=0x66d2b0 <_Py_NoneStruct>, __pyx_v_base_url=0x66d2b0 <_Py_NoneStruct>)
at src/lxml/lxml.etree.c:71797
#10 0x00007ffff08863aa in __pyx_pf_4lxml_5etree_12_ElementTree_parse (__pyx_v_self=0x9cc170, __pyx_args=<optimized out>, __pyx_kwds=<optimized out>) at src/lxml/lxml.etree.c:39625
#11 0x00000000004a0476 in call_function (pp_stack=<optimized out>, oparg=<optimized out>) at Python/ceval.c:4012
#12 PyEval_EvalFrameEx (f=0x7f7170, throwflag=<optimized out>) at Python/ceval.c:2665
#13 0x00000000004a1f74 in PyEval_EvalCodeEx (co=0x7ffff7ee63b0, globals=<optimized out>, locals=<optimized out>, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0)
at Python/ceval.c:3252
#14 0x00000000004a20f2 in PyEval_EvalCode (co=0x7fffffffda14, globals=0x7fff00000000, locals=0x4) at Python/ceval.c:666
#15 0x00000000004c4e90 in run_mod (mod=<optimized out>, filename=<optimized out>, globals=0x7fff00000000, locals=0x4, flags=<optimized out>, arena=<optimized out>) at Python/pythonrun.c:1346
#16 PyRun_FileExFlags (fp=0x776630, filename=0x7fffffffe615 "/opt/monitor/tools/bin/pmon_my", start=<optimized out>, globals=0x6f2140, locals=0x6f2140, closeit=1, flags=0x7fffffffe1ac)
at Python/pythonrun.c:1332
#17 0x00000000004c6109 in PyRun_SimpleFileExFlags (fp=0x776630, filename=0x7fffffffe615 "/opt/monitor/tools/bin/pmon_my", closeit=1, flags=0x7fffffffe1ac) at Python/pythonrun.c:936
#18 0x000000000041462c in Py_Main (argc=<optimized out>, argv=0x7fffffffe358) at Modules/main.c:599
#19 0x00007ffff7114c05 in __libc_start_main () from /lib64/libc.so.6
#20 0x0000000000413aba in _start ()
我假设有2个解决方案 1.在应用程序lib文件夹中为rhel 7.4添加最新的库(libxml2)。但那么如何让python理解使用呢? 2.重新搜索库,链接和加载以查看应用程序lib文件夹,而不是使用系统。
是否与以下变更有关?
错误1292230 - ld无法解析链接到库
的符号令人惊讶的是,在带有trace-children选项的valgrind中运行程序不会产生任何错误。
答案 0 :(得分:0)
我将应用程序文件夹中的符号链接重定向到指向/usr/lib64/libxml2.so.2的系统库。有了它,它工作正常。