Re: [xml] libxml2 and thread-safety



On Mon, Oct 08, 2001 at 12:34:16PM +0200, Federico Di Gregorio wrote:
hi,

developing a little multithreaded app using libxml2 and libxslt i was
bitten by some random segfaults. i traced them back to libxml2, here's
the gdb stack trace:

#0  0x40090961 in startElement () from /usr/lib/libxml2.so.2
#1  0x400c30a1 in htmlParseCharRef () from /usr/lib/libxml2.so.2
#2  0x400c48df in htmlFreeParserCtxt () from /usr/lib/libxml2.so.2


  Hum, I doubt the stack trace is correct:

void
htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
{
    xmlFreeParserCtxt(ctxt); 
}

  I don't see how it could call htmlParseCharRef(), there is something
wrong ...

#3  0x400c52e2 in htmlParseChunk () from /usr/lib/libxml2.so.2
#4  0x4001cd34 in _libwatson_http_search_html (http_context=0x8081b80)
    at watson_http.c:89
[...]
can someone tell me if libxml2 is really thread safe (and the guilty is
my code) or special precautions should be taken when using it in
multithraded environment?

  Check the archives, this was discussed at length last week and is being
worked on. multiple threads parsing different documents should work once
initialized properly, there might be undiscovered problems w.r.t. the HTML
parser though.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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