Re: [xml] LibXml2 Crash in MultiThreaded Windows



Daniel ,

Thanks a lot , it solved the crash !!
I was stucked for many days on it , & quite frustrated to the extent
that I have to re-write my whole portable XML Reader / Writer in Xerces
C++.

Also many thanks to Igor & Rob

I am now calling 
        xmlInitParser();
        xmlCleanupParser();

In my primary thread main() only.
( Without even these 2 the code works & there is no crash )

Xerces has  the equivalent 
        xercesc::XMLPlatformUtils::Initialize();
        xercesc::XMLPlatformUtils::Terminate();

You are allowed to call XMLPlatformUtils::Initialize() and
XMLPlatformUtils::Terminate multiple times, but each call to
XMLPlatformUtils::Initialize() must be matched with a call to
XMLPlatformUtils::Terminate.


Strangely this problem didn't show up in MultiThreaded UNIX environment
where call to xmlCleanupParser(); was within UNIX POSIX pThread's.

What I liked abt LibXml2 APIs were their simplicity 
& in contrast 
I had to achieve the counterpart of 1 LibXml2 C API in Xerces using many
C++ APIs or Classes (which of course has an OO tinge to it).

I have worked earlier on MS-XML too 
( which can be portable provided COM is universally implemented on all
UNIX variants )
but working on LibXML2 Library was really a breeze for me.

Thanks again for ur valuable inputs.

Regds,

Lav

-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com] 
Sent: Tuesday, June 10, 2008 8:02 PM
To: Lav Mehrotra
Cc: Rob Richards; xml gnome org; igor zlatkovic com
Subject: Re: [xml] LibXml2 Crash in MultiThreaded Windows

On Tue, Jun 10, 2008 at 06:35:10PM +0530, Lav Mehrotra wrote:
NOTE : Within my thread I create Reader / Writer object on Stack so it
goes out of scope when the thread fun exits , calls Dtor of Reader /
Writer object , which does 

xmlFreeDoc(m_ptrXMLDoc);
xmlCleanupParser();

  If you call xmlCleanupParser from the threads on concurrent accesses
you
are garanteed to crash...
Read the docs. Looks at the many time i posted about the issue !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


DISCLAIMER:
This email may contain confidential or privileged information for the intended recipient(s) and the views 
expressed in the same are not necessarily the views of Zensar Technologies Ltd. If you are not the intended 
recipient or have received this e-mail by error, its use is strictly prohibited, please delete the e-mail and 
notify the sender. Zensar Technologies Ltd. does not accept any liability for virus infected mails. 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]