Created attachment 431315 [details] A sample program for reproduction. Description of problem: Because libxml2 included in release is not thread safe, a problem occurs. Firstly this problem was discussed in a mailing list of next Pacemaker. * http://www.gossamer-threads.com/lists/linuxha/pacemaker/61182 In addition, that there is a problem in libxml2 is announced in the site of libxml2. * http://xmlsoft.org/threads.html Please please update libxml2 in new rpm. And please notify all official users of it. Version-Release number of selected component (if applicable): libxml2-devel-2.6.26-2.1.2.8 libxml2-2.6.26-2.1.2.8 How reproducible: Problem can reappear by the sample program that I attached. Steps to Reproduce: 1.Build the sample program of the test. * cc test_thread.c xml2-config --cflags --libs -o test_thread -lpthread 2.Carry out test_thread. Look at the state for a while. 3.In the environment of libxml2.6.26, plural search results are acquired.(A problem happens.) libxml2[thread=12] test getcount[3] libxml2[thread=12] test getcount[3]line[0] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] libxml2[thread=12] test getcount[3]line[1] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] libxml2[thread=12] test getcount[3]line[2] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] 4.In the environment of libxml2-2.7.2, one search results is acquired definitely.(OK) libxml2[thread=7] test getcount[1]line[0] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] libxml2[thread=8] test getcount[1] libxml2[thread=8] test getcount[1]line[0] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] libxml2[thread=9] test getcount[1] libxml2[thread=9] test getcount[1]line[0] path[/cib/status/node_state/transient_attributes/instance_attributes/nvpair] Actual results: Plural results are provided in the environment of libxml2.6.26. Expected results: One result is provided. Additional info: A sample program for reproduction. (The sample program is very simple and omits error processing)
First note: the program provided does not follow the recommendations from http://xmlsoft.org/threads.html as it does not call xmlInitParser() in the "main" thread before using any of the libxml2 API Daniel
Tested on RHEL-5.5, program compiled as expected shows results where [3] elements are retourned. Simply adding xmlInitParser() as stated in libxml2 documentation seems to fix the problem for me, in a nutshell sounds like a bogus app, trivially fixed, please try to fix the real program and report. Daniel
Okay I have been looking at it more deeply, th problem still persists if I add xmlInitParser() in main(), it just didn't show up on my few test runs ... Now I can reproduce this and I'm trying to find this out, but it's not simple ! Daniel
Created attachment 451508 [details] Patch fixing the random XPath problem The problem wasn't a threading bug it was related to a lack of initialization in an internal data structure, patch attached Daniel
Hi Daniel, > Created attachment 451508 [details] > Patch fixing the random XPath problem > The problem wasn't a threading bug it was related to a lack of initialization > in an internal data structure, patch attached I confirmed that the problem was solved with your patch. This revision seems to be performed in libxml2-2.7.2. Best Regards, Hideo Yamauchi.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Due to an uninitialized field in one of the private libxml2 XPath data structures, the XPath evaluation may have return incorrect results. This error has been fixed, the field is now initialized properly, and XPath evaluation returns expected results.
Fixed in build libxml2-2.6.26-2.1.12 targetted at RHEL-5.7, Daniel
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-1053.html