title: Segmentation fault on RHEL environment 7.4 (works on RHEL 6)
body: <p>I have a in-house python program that ships with python interpreter and some libraries to production. It works fine on RHEL 6 environments.</p>
  
  <p>However on RHEL 7.4 it some how throws segmentation fault.
  We suspect system library is being overriden by application library libxml2.</p>
  
  <p>Backtrace :</p>
  
  <pre><code>(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 &lt;_Py_NoneStruct&gt;, __pyx_v_base_url=0x66d2b0 &lt;_Py_NoneStruct&gt;)
      at src/lxml/lxml.etree.c:71797
  #10 0x00007ffff08863aa in __pyx_pf_4lxml_5etree_12_ElementTree_parse (__pyx_v_self=0x9cc170, __pyx_args=&lt;optimized out&gt;, __pyx_kwds=&lt;optimized out&gt;) at src/lxml/lxml.etree.c:39625
  #11 0x00000000004a0476 in call_function (pp_stack=&lt;optimized out&gt;, oparg=&lt;optimized out&gt;) at Python/ceval.c:4012
  #12 PyEval_EvalFrameEx (f=0x7f7170, throwflag=&lt;optimized out&gt;) at Python/ceval.c:2665
  #13 0x00000000004a1f74 in PyEval_EvalCodeEx (co=0x7ffff7ee63b0, globals=&lt;optimized out&gt;, locals=&lt;optimized out&gt;, 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=&lt;optimized out&gt;, filename=&lt;optimized out&gt;, globals=0x7fff00000000, locals=0x4, flags=&lt;optimized out&gt;, arena=&lt;optimized out&gt;) at Python/pythonrun.c:1346
  #16 PyRun_FileExFlags (fp=0x776630, filename=0x7fffffffe615 "/opt/monitor/tools/bin/pmon_my", start=&lt;optimized out&gt;, 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=&lt;optimized out&gt;, argv=0x7fffffffe358) at Modules/main.c:599
  #19 0x00007ffff7114c05 in __libc_start_main () from /lib64/libc.so.6
  #20 0x0000000000413aba in _start ()
  </code></pre>
  
  <p>I am assuming 2 solutions to this
  1. Add latest libraries (libxml2) for rhel 7.4 in application lib folder. But then how to make python understand to use it ?
  2. Reroute library search, linking and loading to look into application lib folder instead of using system.</p>
  
  <p>Is it related to following change ?</p>
  
  <p>Bug 1292230 - ld doesn't resolve symbols in linked to library</p>
  
  <p>Surprisingly running the program in valgrind with trace-children option does not give any error. </p>