I have reached wits end on this one.

I am running on RedHat 7.1, with gcc's 2.96-112.7.1
I even applied the fix-patch from XERCESC-1162 about base class warnings in
SAXException

I plugged in an eval copy of Purify and got the following:
------------------------------------------------------------------------
****  Purify instrumented PureMyServer (pid 18321 at Thu Nov 18 16:18:57
2004)
  * Purify 2003a.06.13 Linux (32-bit) (c) Copyright IBM Corp. 1992, 2004 All
rights reserved.  
  * For contact information type: "purify -help"
  * For TTY output, use the option "-windows=no"
  * Command-line: PureMyServer 
  * Options settings: -g++=yes -purify \
    -purify-home=/home/igor/scratch/releases/purify.i386_linux2.2003a.06.13
\
 
-cache-dir=/home/igor/scratch/releases/purify.i386_linux2.2003a.06.13/cache
\
    -hw_cap=yes -language=english 
  * License successfully checked out.
  * Command-line: PureMyServer 

****  Purify instrumented PureMyServer (pid 18321)  ****
IPR: Invalid pointer read:
  * This is occurring while in thread 1026:
        xercesc_2_6::XMemory::operator delete(void*) [XMemory.cpp:80]
        xercesc_2_6::ValidationContextImpl::~ValidationContextImpl(void)
[ValidationContextImpl.cpp:56]
        xercesc_2_6::SchemaInfo::~SchemaInfo(void) [SchemaInfo.cpp:170]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::removeAll(void)
[RefHash2KeysTableOf.c:207]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::~RefHash2KeysTabl
eOf(void) [RefHash2KeysTableOf.c:152]
        xercesc_2_6::TraverseSchema::cleanUp(void) [TraverseSchema.cpp:8415]
  * Reading 4 bytes from 0x480a9210 between the heap and the stack.

****  Purify instrumented PureMyServer (pid 18321)  ****
ZPR: Zero page read:
  * This is occurring while in thread 1026:
        xercesc_2_6::XMemory::operator delete(void*) [XMemory.cpp:82]
        xercesc_2_6::ValidationContextImpl::~ValidationContextImpl(void)
[ValidationContextImpl.cpp:56]
        xercesc_2_6::SchemaInfo::~SchemaInfo(void) [SchemaInfo.cpp:170]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::removeAll(void)
[RefHash2KeysTableOf.c:207]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::~RefHash2KeysTabl
eOf(void) [RefHash2KeysTableOf.c:152]
        xercesc_2_6::TraverseSchema::cleanUp(void) [TraverseSchema.cpp:8415]
  * Reading 4 bytes from 0x3e

****  Purify instrumented PureMyServer (pid 18321)  ****
COR: Fatal core dump:
  * This is occurring while in thread 1026:
        xercesc_2_6::XMemory::operator delete(void*) [XMemory.cpp:82]
        xercesc_2_6::ValidationContextImpl::~ValidationContextImpl(void)
[ValidationContextImpl.cpp:56]
        xercesc_2_6::SchemaInfo::~SchemaInfo(void) [SchemaInfo.cpp:170]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::removeAll(void)
[RefHash2KeysTableOf.c:207]
        
xercesc_2_6::RefHash2KeysTableOf<xercesc_2_6::SchemaInfo>::~RefHash2KeysTabl
eOf(void) [RefHash2KeysTableOf.c:152]
        xercesc_2_6::TraverseSchema::cleanUp(void) [TraverseSchema.cpp:8415]
  * Received signal 11 (SIGSEGV - Segmentation fault)
  * Handler function: SIG_DFL
  * Faulting address = 0x3e
  * Signal mask: (SIGQUIT | SIGTRAP | SIGBUS | SIGFPE | SIGUSR1 | \
    SIGSEGV | SIGUSR2 | SIGALRM | SIGTERM | SIGSTKFLT | SIGCHLD | \
    SIGCONT | SIGSTOP | SIGSTP | SIGTTIN | SIGTTOU | SIGURG | SIGXCPU | \
    SIGXFSZ | SIGVTALRM | SIGPROF | SIGWINCH | SIGIO | SIGPWR | \
    SIGReserved32 | SIGReserved35 | SIGReserved36 | SIGReserved37 | \
    SIGReserved39 | SIGReserved40 | SIGReserved42 | SIGReserved44 | \
    SIGReserved46 | SIGReserved47 | SIGReserved48 | SIGReserved49 | \
    SIGReserved50 | SIGReserved51 | SIGReserved52 | SIGReserved53 | \
    SIGReserved54 | SIGReserved55 | SIGReserved56 | SIGReserved57 | \
    SIGReserved58 | SIGReserved59 | SIGReserved60 | SIGReserved61 | \
    SIGReserved62) 
  * Pending signals: (SIGHUP | SIGQUIT | SIGTRAP | SIGBUS | SIGKILL | \
    SIGUSR1 | SIGSEGV | SIGUSR2 | SIGPIPE | SIGALRM | SIGTERM | \
    SIGSTKFLT | SIGCHLD | SIGCONT | SIGSTOP | SIGSTP | SIGTTIN | \
    SIGTTOU | SIGURG | SIGXCPU | SIGXFSZ | SIGVTALRM | SIGPROF | \
    SIGWINCH | SIGIO | SIGPWR | SIGUNUSED | SIGReserved32 | \
    SIGReserved36 | SIGReserved37 | SIGReserved39 | SIGReserved41 | \
    SIGReserved43 | SIGReserved44 | SIGReserved50 | SIGReserved52 | \
    SIGReserved60) 

-----Original Message-----
From: White Daniel E CONT DLVA [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 17, 2004 11:54 AM
To: '[EMAIL PROTECTED]'
Subject: SegFaullt problem


OK, I have an object class definition for a server application
that contains:

//--------------------------------------------------------------------

        XercesDOMParser*       parser ;
        DOMTreeErrorReporter*  errReporter ;

//--------------------------------------------------------------------

When I instantiate/open the object, I do this:

//--------------------------------------------------------------------

        this->parser = new XercesDOMParser;
        this->parser->setDoNamespaces( true );
        this->parser->setDoSchema( true );
        this->parser->setValidationSchemaFullChecking( true );
        this->parser->setValidationScheme( XercesDOMParser::Val_Auto );
        this->parser->setCreateEntityReferenceNodes( false );
        this->parser->setExternalNoNamespaceSchemaLocation
                ( /* path to schema file location*/ ) ;
        this->errReporter = new DOMTreeErrorReporter();

        this->parser->setErrorHandler(this->errReporter);

//--------------------------------------------------------------------

And then I have a method called "validate" that does this:

//--------------------------------------------------------------------

bool myStreamHandler::validate ( int size, const char* buffer )
{
        bool rc = true ;
        const char* foo = "label" ; 
        // the error reporter object gets destroyed,
        // so it needs to be re-instantiated to reuse this parser
        if ( !this->errReporter )
        {   this->errReporter = new DOMTreeErrorReporter();
                this->parser->setErrorHandler(this->errReporter);
        }

        // convert the ascii text buffer to a form the parser will accept
        MemBufInputSource* memBufIS = new MemBufInputSource
                (   (const XMLByte*) buffer, 
                        size,
                        foo,
                        false
                ) ;

        // validate it
        try
        {
                this->parser->parse( *memBufIS ) ;

                if ( this->parser->getErrorCount() > 0 )
                {   cerr
                                << "Got "
                                << this->parser->getErrorCount()
                                << " errors"
                                << endl ;

                        rc = false ; 
                }
        }
        catch ( const XMLException& e )
        {
                ...
        }
        catch (const DOMException& e)
        {
                ...
        }
        catch (...)
        {
                ...
        }

        // cleanup
        delete memBufIS ;

        return rc ;
}

//--------------------------------------------------------------------

The problem is that I get occasional Segnentation Faults on either the 
creation of the MemBufInputSource object "memBufIS" or when I try to 
parse it a few lines later.

I am using Xerces-C 2.6.0

Am I doing this properly or is there a differrent/better way to do it ?

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

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

Reply via email to