Bug 613860 - A problem of libxml2 which is not thread safe.
A problem of libxml2 which is not thread safe.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libxml2 (Show other bugs)
5.5
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Daniel Veillard
BaseOS QE - Apps
: ZStream
Depends On:
Blocks: 590060 640191
  Show dependency treegraph
 
Reported: 2010-07-12 21:14 EDT by HIDEO YAMAUCHI
Modified: 2013-01-10 22:07 EST (History)
6 users (show)

See Also:
Fixed In Version: libxml2-2.6.26-2.1.12
Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-07-21 07:13:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
A sample program for reproduction. (4.29 KB, application/x-zip-compressed)
2010-07-12 21:14 EDT, HIDEO YAMAUCHI
no flags Details
Patch fixing the random XPath problem (431 bytes, patch)
2010-10-04 15:44 EDT, Daniel Veillard
no flags Details | Diff

  None (edit)
Description HIDEO YAMAUCHI 2010-07-12 21:14:21 EDT
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)
Comment 2 Daniel Veillard 2010-10-01 11:51:10 EDT
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
Comment 3 Daniel Veillard 2010-10-01 12:06:39 EDT
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
Comment 8 Daniel Veillard 2010-10-04 13:47:38 EDT
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
Comment 9 Daniel Veillard 2010-10-04 15:44:42 EDT
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
Comment 13 HIDEO YAMAUCHI 2010-10-05 05:20:52 EDT
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.
Comment 15 Jaromir Hradilek 2010-10-06 19:29:33 EDT
    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.
Comment 21 Daniel Veillard 2011-04-21 08:04:05 EDT
Fixed in build libxml2-2.6.26-2.1.12 targetted at RHEL-5.7,

Daniel
Comment 26 errata-xmlrpc 2011-07-21 07:13:59 EDT
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

Note You need to log in before you can comment on or make changes to this bug.