Hi,

The Xerces DOM parser seems to be crashing in a multithreaded env.

I tried running the thread test program (attached to this mail). This is the thread
test program that [EMAIL PROTECTED] had posted with a similar problem earlier.
He uses Xerces 1.4, I use Xerces 1.2.0.

Heres the results I got (it crashed on both Single-CPU as well as Multi-CPU m/c).
 

    Single CPU Sun Box (Ultra 10)

    To suppress this message, add the following line to your .dbxrc file:

        dbxenv suppress_startup_message 3.2
    Reading symbolic information for MultiCPU
    Reading symbolic information for rtld /usr/lib/ld.so.1
    Reading symbolic information for libxerces-c1_2.so
    Reading symbolic information for libc.so.1
    Reading symbolic information for libgen.so.1
    Reading symbolic information for libsunmath.so.1
    Reading symbolic information for libm.so.1
    Reading symbolic information for libC.so.5
    Reading symbolic information for libw.so.1
    dbx: warning: rtc: /usr/lib/libw.so.1 does not belong to any section
    Reading symbolic information for libpthread.so.1
    Reading symbolic information for libnsl.so.1
    Reading symbolic information for libsocket.so.1
    Reading symbolic information for libdl.so.1
    Reading symbolic information for libmp.so.2
    Reading symbolic information for libc_psr.so.1
    Reading symbolic information for libthread.so.1
    detected a multithreaded program
    (dbx) run 1
    Running: MultiCPU 1
    (process id 14690)
    Testing file  for 1 threads.
    Thread 0
    DONE

    execution completed, exit code is 0
    (dbx) run 2
    Running: MultiCPU 2
    (process id 14691)
    Testing file  for 2 threads.
    Thread 0
    Thread 1
    DONE

    execution completed, exit code is 0
    (dbx) run 3
    Running: MultiCPU 3
    (process id 14692)
    Testing file  for 3 threads.
    Thread 0
    Thread 1
    Thread 2
    t@6 (l@21) signal BUS (invalid address alignment) in RecursiveMutex::unlock at line 626 in file "SolarisPlatformUtils.cpp"
      626                             if (--recursionCount > 0)
    (dbx) run 4
    Running: MultiCPU 4
    (process id 14693)
    Testing file  for 4 threads.
    Thread 0
    Thread 1
    Thread 2
    Thread 3
    t@6 (l@5) signal BUS (invalid address alignment) in RecursiveMutex::unlock at line 626 in file "SolarisPlatformUtils.cpp"
      626                             if (--recursionCount > 0)
    (dbx)
 

    Multi-CPU Sun BOX
 

    Reading symbolic information for MultiCPU
    Reading symbolic information for rtld /usr/lib/ld.so.1
    Reading symbolic information for libxerces-c1_2.so
    Reading symbolic information for libc.so.1
    Reading symbolic information for libgen.so.1
    Reading symbolic information for libsunmath.so.1
    Reading symbolic information for libm.so.1
    Reading symbolic information for libC.so.5
    Reading symbolic information for libw.so.1
    dbx: warning: rtc: /usr/lib/libw.so.1 does not belong to any section
    Reading symbolic information for libpthread.so.1
    Reading symbolic information for libnsl.so.1
    Reading symbolic information for libsocket.so.1
    Reading symbolic information for libdl.so.1
    Reading symbolic information for libmp.so.2
    Reading symbolic information for libc_psr.so.1
    Reading symbolic information for libthread.so.1
    detected a multithreaded program
    (dbx) run 1
    Running: MultiCPU 1
    (process id 6908)
    Testing file  for 1 threads.
    Thread 0
    DONE

    execution completed, exit code is 0
    (dbx) run 2
    Running: MultiCPU 2
    (process id 6909)
    Testing file  for 2 threads.
    Thread 0
    Thread 1
    DONE

    execution completed, exit code is 0
    (dbx) run 3
    Running: MultiCPU 3
    (process id 6910)
    Testing file  for 3 threads.
    Thread 0
    Thread 1
    Thread 2
    t@4 (l@4) signal SEGV (no mapping at the fault address) in XMLScanner::emitError at line 1009 in file "XMLScanner.cpp"
     1009           fErrorReporter->error
    (dbx) run 4
    Running: MultiCPU 4
    (process id 6911)
    Testing file  for 4 threads.
    Thread 0
    Thread 1
    Thread 2
    Thread 3
    DONE

    execution completed, exit code is 0
    (dbx) run 5
    Running: MultiCPU 5
    (process id 6912)
    Testing file  for 5 threads.
    Thread 0
    Thread 1
    Thread 2
    Thread 3
    Thread 4
    t@8 (l@7) signal BUS (invalid address alignment) in _smalloc at 0xff045500
    _smalloc+0x88:  ld      [%o1 + 0x8], %o0
    Current function is NameIdPool<DTDElementDecl>::put
      257       NameIdPoolBucketElem<TElem>* newBucket = new NameIdPoolBucketElem<TElem>
    (dbx)

Are we missing out on anything or is this a bug in the DOMParser.  The SAXParser seems to be working fine.

Please reply.

Thanks,
Nikita

// thrTest.cpp

#include <iostream.h>
#include <stdlib.h>
#include <util/PlatformUtils.hpp>
#include <dom/DOM.hpp>
#include <parsers/DOMParser.hpp>
#include <parsers/SAXParser.hpp>
#include <framework/MemBufInputSource.hpp>
#include <pthread.h>

#define MAXTESTTHREADS 512

void* worker(void* arg);

int main(int argc, char *argv[]) {

        if(argc == 2) {
                int numThreads = atoi(argv[1]);

                if(numThreads > MAXTESTTHREADS)
                        return -1;

                cout << "Testing file  for " << numThreads << " threads.\n";

                XMLPlatformUtils::Initialize();

                pthread_t p_thread[MAXTESTTHREADS];

                int ret = pthread_setconcurrency(20);

                for(int num=0; num < numThreads ; num++)
                        pthread_create(&p_thread[num], NULL, worker, NULL);

                for(num=0; num < numThreads ; num++)
                        pthread_join(p_thread[num], NULL);

                cout << "DONE" << endl;

        }
        else {
                cout << "Usage:\n\t thrTest <numOfThreads>\n";
        }

        return 0;

}

void* worker(void* arg) {

        static int trdCount = 0;
        cout << "Thread " << trdCount++ << endl;
        const XMLByte memChar[] =
"<config><item1><item2/></item1></config>";
        char *fakeSysID = "fakeID";

        for(int i = 0; i < 1000; i++) {
                DOMParser parser;
                //SAXParser parser;
                MemBufInputSource memSource(memChar, sizeof(memChar)-1,
fakeSysID, false);
                parser.parse(memSource);
                DOM_Document domDoc = parser.getDocument();
        }

        return(NULL);
}
begin:vcard 
n:Sawant;Nikita 
x-mozilla-html:FALSE
org:iPlanet Group
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;0
fn:Nikita Sawant
end:vcard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to