[xml] xmlParseFile Deadlock



Hi all,

I'm using libxml2-2.6.6-3.x86_64 on RHEL3.
I am trying to write a program in c that receives URLs to XML files from a database and then creates a thread for each row.
I'm getting a deadlock when 2 threads call xmlParseFile at the same time.

I call xmlInitParser() before creating the threads.

The backtrace from gdb is
#0  0x0000002a95907439 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/tls/libpthread.so.0
#1  0x0000002a965cf310 in xmlRMutexLock () from /usr/lib64/libxml2.so.2
#2  0x0000002a965cb5fd in xmlParseCatalogFile () from /usr/lib64/libxml2.so.2
#3  0x0000002a965cc3b7 in xmlParseCatalogFile () from /usr/lib64/libxml2.so.2
#4  0x0000002a965cd5d1 in xmlACatalogResolve () from /usr/lib64/libxml2.so.2
#5  0x0000002a965cdd60 in xmlCatalogResolve () from /usr/lib64/libxml2.so.2
#6  0x0000002a965977ba in xmlCheckHTTPInput () from /usr/lib64/libxml2.so.2
#7  0x0000002a96597896 in xmlLoadExternalEntity () from /usr/lib64/libxml2.so.2
#8  0x0000002a96587f05 in xmlCreateURLParserCtxt () from /usr/lib64/libxml2.so.2
#9  0x0000002a96587f8b in xmlCreateFileParserCtxt () from /usr/lib64/libxml2.so.2
#10 0x0000002a96587fb1 in xmlSAXParseFileWithData () from /usr/lib64/libxml2.so.2
#11 0x0000002a965880bb in xmlSAXParseFile () from /usr/lib64/libxml2.so.2
#12 0x0000002a965880f0 in xmlParseFile () from /usr/lib64/libxml2.so.2
#13 0x0000000000401c4c in search_instance (thread_arg=0x7fbfff8460) at search_thread.c:131
#14 0x0000002a95904c64 in start_thread () from /lib64/tls/libpthread.so.0
#15 0x0000002a969ae243 in thread_start () from /lib64/tls/libc.so.6
#16 0x0000000000000000 in ?? ()

The backtrace is the same for each locked thread.
If two threads call xmlParseFile at different times everything works.

The thread code looks like

void
*parse( void *thread_arg )
{
    xmlDocPtr         doc;
   
    search_data *threadData = (search_data *)thread_arg;
    doc = xmlParseFile(threadData->URL);
 
   ....
 }

Am I doing something wrong here? Thanks for any help.

-rhys


--
Regards

Rhys Palmer | Developer
___________________________________
dStore Australia Pty Ltd
Level 2, 77 Elizabeth Street
Brisbane QLD 4000
Australia
p. 1800 DSTORE (Australia)
   +617 3223 6111 (International)
f. +617 3211 2556
e. rpalmer dstore com
www.dstore.com

Your global department store

NOTICE:
This email and any attachment/s may contain confidential and/or privileged information. If you are not the intended recipient, please contact dStore Australia Pty Ltd immediately by return email or by telephone on 1800 378 673. You should not copy, distribute or disclose all or any part of this email unless you are authorised to do so.

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