Some methods do not support multi-thread.
-----------------------------------------

                 Key: TUSCANY-2749
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2749
             Project: Tuscany
          Issue Type: Bug
          Components: C++ SDO
    Affects Versions: Cpp-M3
         Environment: Windows XP
Visual C++6.0 
CPP-tuscany_sdo-M3
libxml2-2.7.2
iconv-1.7.2
zlib-1.2.3
boost-1.33.1
            Reporter: Yuling Zhang
             Fix For: Cpp-Next


The methods object-serializing/object-antiserializing related will get failed 
in multi-threaded envoriment.
They are as followed:
//used when antiserializing a SDO object from a character string
const char*  XSDHelperImpl::define(const char* schema, bool 
loadImportNamespace= "")

//used when serializing a SDO object into a character string
char* XMLHelperImpl::save(
            DataObjectPtr dataObject,
            const char* rootElementURI,
            const char* rootElementName,
            int indent= -1)

// used when serializing a SDO object into a xml file
void XMLHelperImpl::save(
            DataObjectPtr dataObject,
            const char* rootElementURI,
            const char* rootElementName,
            const char* xmlFile,
            int indent = -1)

//used when get a SOD object's shcema character string
char* XSDHelperImpl::generate(
            const TypeList& types,
            const char* targetNamespaceURI = "",
            int indent = -1)

//used when get a SDO object's schema file
void XSDHelperImpl::generateFile(
            const TypeList& types,
            const char* fileName, 
            const char* targetNamespaceURI = "",
            int indent = -1)


(The multi-thread lib used to test these methods is boost-1.33.1.)
All of them are successed in the first thread but get failed from the second 
thread.
The exceptions are catched by "catch(...)" not by "catch (SDORuntimeException 
e)".
Because only one method is successed in multi-threaded envoriment that 
serializs a SDO object from a file(it is defineFile from XSDHelperImpl), I made 
a comparision of it with the unsafe methods listed above. I find the reason of 
these mehtods getting failed in multi-threaeded envoriment is that they call 
some operations from libxml2 which are multi-thread unsafe. In the patch 
provided I changed the implemention of stream_twice method from SAX2Parser 
which is called by define method from XSDHelperImpl.The changement is mainly 
the replacment of unsafe method of libxml2 with a safe one. For the rest of the 
methods above, I do not find corresponding safe methods to replace the unsafe 
ones, so they still remain unresolved.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to