Hi,
I looked at the doc for XPathEvaluator::initialize() and while it is
listed as a static function , it does NOT warn you that you cannot call
this from anywhere but the main thread, before the other threads start, in
a multi-threaded environment. Is the same thing true for the Terminate()
functions of XML and XPathEvaluator() also?
And does this mean that ALL initialize() or terminate() sorts of
functions for ANYTHING in Xalan or Xerces must also be done only in a
single threaded environment? For example, would this also be true for
XalanSourceTreeInit()? The doc on that says nothing at all about
threadedness. In fact, the doc says very little about anything.
Suzanne
David N
Bertoni/Cambridge To: [EMAIL PROTECTED]
/IBM cc:
<david_n_bertoni@ Subject: Re:
XPathEvaluator::initialize()
us.ibm.com>
03/26/2003 04:41
PM
Please respond to
xalan-dev
Hi Suzanne,
No, static iniitialization in Xalan is never thread-safe. You should call
it once from the main thread, before any other threads start. If it's not
documented as such, that's a documentation bug, and should be fixed.
The crash is because Xalan does some initialization of static data itself,
which requires transcoding. Most of this is removed in newer versions of
Xalan, but some is still there.
Note that the Xerces initialization function PlatformUtils::Initialize()
has the same limitation.
Dave
Suzanne Dirkers
<[EMAIL PROTECTED] To:
[EMAIL PROTECTED]
com> cc: (bcc: David N
Bertoni/Cambridge/IBM)
Subject:
XPathEvaluator::initialize()
03/26/2003 12:49
PM
Please respond
to xalan-dev
Hi ,
Is XPathEvaluator::initialize() supposed to be
thread-safe if you call it in each thread after
XMLPlatformUtils::Initialize() similar to how SImpleXPathAPI does it? I
find that if I try to run an application that is essentially SimpleXPathAPI
logic being called independently for each one within a set of multiple
threads (no, they are NOT using the same objects, that I know of), if I try
it with more than 2 threads, I end up with a protection exception on a call
stack that look like this:
0C3239C0 +00000072 XMLString::transcode(const char* const,unsigned
short* const
0C3239C0
+00000072 *PATHNAM Exception
0C843C98 0B624018 +000001C2 doXercesTranscode(const
char*,unsigned int,int,vector<unsign
0B624018
+000001C2 *PATHNAM Call
0C843BB0 0B6245E8 +0000015A
doTranscodeFromLocalCodePage(const char*,unsigned int,int,ve
0B6245E8
+0000015A *PATHNAM Call
0C8439D8 0B626A40 +00000164
XalanDOMString::append(const char*,unsigned int)
0B626A40
+00000164 *PATHNAM Call
0C8438F8 0B625810 +0000009A
XalanDOMString::XalanDOMString(const char*,unsigned int)
0B625810
+0000009A *PATHNAM Call
0C8437C8 0B649C10 +00000082
DOMStringHelperInitialize()
0B649C10
+00000082 *PATHNAM Call
0C8436F0 0B65D388 +000000A8
PlatformSupportInit::PlatformSupportInit()
0B65D388
+000000A8 *PATHNAM Call
0C843618 0B7DB0D0 +00000078 XPathInit::XPathInit()
0B7DB0D0
+00000078 *PATHNAM Call
0C843540 0B7BB1C0 +00000092
XPathEvaluator::initialize()
0B7BB1C0
+00000092 *PATHNAM
One question I have is: what is the transcode trying to work on?
XPathEvaluator::initialize() never had any arguments from anything I passed
into it.
Is it possible that DOMStringHelperInitialize() is trying to work
with something global that is not set up separately for each thread and
then trying to do a TranscodeFromLocalCodePage on it?
How does one assure that the XPathEvaluator::initialize() is
properly set up for multi-threading?
Thanks,
Suzanne