[xml] Initialization problem



  We are designing an application using your libxml2 (2.6.23). We experienced some problems with that version and with the latest one. It seams that in multi thread environment some initialization code does not work correctly (it of course can be a bad use from us). The fact is that when the globalkey (pthread environment) value is 0 (occurs for the first thread) the thread specific memory is not set up correctly and then we have a lot of problem (indeed the DefaultXmlBufferSize has random values…). With every non-zero value everything works good.

  I made a change to fix it in my particulare case but I’m quite sure that this is not the good way to fix it. Here is the change I did in thread.c:784 (in red)


static void

xmlOnceInit(void) {


    (void) pthread_key_create(&globalkey, xmlFreeGlobalState);


       (void) pthread_key_create(&globalkey, xmlFreeGlobalState);

    mainthread = pthread_self();



#if defined(HAVE_WIN32_THREADS)

    if (!run_once.done) {

        if (InterlockedIncrement(&run_once.control) == 1)


#if !defined(HAVE_COMPILER_TLS)

            globalkey = TlsAlloc();




  Could you please inform me if this problem is due to a bad use of your library or if you already experienced the same problem ?


  Thank you for your help,




Sylvain Lecorné.

This e-mail and any attachments may be confidential and/or legally privileged. If you have received this e-mail and you are not a named addressee, please inform the Experian Decision Analytics Service Desk on +377 97975353 and then delete the e-mail from your system. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail. Although Experian routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Experian makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of its clients and business, Experian may monitor and read e-mails sent to and from its servers

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