Re: [xml] Deadlock in catalog.c?



On Fri, Feb 11, 2011 at 12:42:42PM +0100, Mark Van Peteghem wrote:
Hi,

I'm stuck on what looks like a deadlock in libxml2.

My application calls xmlInitializeCatalog() and xmlLoadCatalog(...)
(which returns 0) in the main thread. Then another thread is
launched in which I do XML validation with DTDs. These work fine
until a XML file refers to a DTD that has to be looked up in the
catalog file that I loaded with xmlLoadCatalog(...): then the thread
blocks when trying to lock xmlCatalogMutex (catalog.c, line 1416 in
the function xmlFetchXMLCatalogFile). The strange thing is that
there are no other threads doing any locking (except for the thread
created by libxml2 that waits in xmlGlobalStateCleanupHelper).

I noticed that if I do the same XML validation on the main thread,
it works fine, and after that it works on the other thread as well.

  Provide a self contained example showing the problem.
If you look at the source code there is a program testThreads.c
which do exercise threading and catalogs in a concurrent way.
Also make 100% sure you did call xmlInitParser() in the main thread
prior to any multithreaded operations, c.f. the documentation:

  http://xmlsoft.org/threads.html

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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