Bug 613860 - A problem of libxml2 which is not thread safe.
Summary: A problem of libxml2 which is not thread safe.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libxml2
Version: 5.5
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 590060 640191
TreeView+ depends on / blocked
 
Reported: 2010-07-13 01:14 UTC by HIDEO YAMAUCHI
Modified: 2018-10-27 14:08 UTC (History)
6 users (show)

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.
Clone Of:
Environment:
Last Closed: 2011-07-21 11:13:59 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1053 0 normal SHIPPED_LIVE libxml2 bug fix update 2011-07-20 15:43:28 UTC

Description HIDEO YAMAUCHI 2010-07-13 01:14:21 UTC
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 15:51:10 UTC
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 16:06:39 UTC
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 17:47:38 UTC
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 19:44:42 UTC
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 09:20:52 UTC
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 23:29:33 UTC
    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 12:04:05 UTC
Fixed in build libxml2-2.6.26-2.1.12 targetted at RHEL-5.7,

Daniel

Comment 26 errata-xmlrpc 2011-07-21 11:13:59 UTC
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.