[xsd-users] about xml error

Boris Kolpackov boris at codesynthesis.com
Thu Sep 25 03:28:41 EDT 2008


Hi Akram,

akram.eslami at se.transport.bombardier.com <akram.eslami at se.transport.bombardier.com> writes:

> I have a server program that I get xml message and after it I parse the 
> message and send it back as xml again.
> I get this error when I debug my program.
> 
> t at 2 (l at 2) terminated by signal SEGV (no mapping at the fault address)
> 0xfea43690: findBucketElem+0x002c:      ld       [%i3 + %l7], %i5
> Current function is xsd::cxx::xml::initialize
>    80           xercesc::XMLPlatformUtils::Initialize ();

Is your server multi-threaded? If so then this can be caused by
concurrent calls to XMLPlatformUtils::Initialize() from multiple
threads.

In multi-threaded applications you need to explicitly call 
Initialize() from main() (or a similar place where there is
still no multi-threaded execution) and then pass the
xml_schema::flags::dont_initialize flag to parsing and
serialization functions:


#include <xercesc/util/PlatformUtils.hpp>

int
main ()
{
  xercesc::XMLPlatformUtils::Initialize ();

  {
    // Start/terminate threads and parse/serialize here:

    std::auto_ptr<type> t = parse ("file.xml", 
                                   xml_schema::flags::dont_initialize);

    serialize (std::cout, 
               *t, 
               map, 
               "UTF-8", 
               xml_schema::flags::dont_initialize)
  }

  xercesc::XMLPlatformUtils::Terminate ();
}

For more information on thread safety see Section 3.4., "Thread Safety"
in the C++/Tree Mapping Getting Started Guide:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#3.4


If your server is not multi-threaded or if this change does not help then
we will need a test that reproduces this problem. You can send it directly
to me if you would prefer not to make your schema/code public.

Boris




More information about the xsd-users mailing list