You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Smith, Peter (ELSLON)" <P....@elsevier.com> on 2003/10/28 10:07:15 UTC

multi-threaded issues on a multi-cpu machine

Hi,

I have a web application that caches DOMs (for site navigation, page layout
etc..) internally. 

I am having problems with exceptions being thrown from within
org.apache.xerces.dom.DeferredDocumentImpl when reading the DOMs (eg. in a
xpath operation, when applying a stylesheet)

Some examples of the exceptions that are being thrown:
- synchronizeData() : NullPointerException
- getNodeObject() : java.lang.IllegalArgumentException: type: -1
- getNodeValueString() -> java.util.Vector.elementAt():
java.lang.ArrayIndexOutOfBoundsException: 4 >= 0

These exceptions only occur when running the application on a multi-cpu
machine.

Has anyone seen problems like this before?

Using xerces-2.5.0.

Regards,
Peter Smith

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: multi-threaded issues on a multi-cpu machine

Posted by Michael Glavassevich <mr...@apache.org>.
Hello Peter,

The reason why you're getting all of these exceptions is that Xerces'
DOM implementation is not thread safe [1]. Since there's no requirement
that a DOM be thread safe, you need to make sure that your threads are
properly synchronized for concurrent access to the DOM. This is true even
if you're just reading the tree. Xerces has a deferred DOM implementation
(the one that you're seeing exceptions with), which defers construction of
nodes until they're actually read. It's a form of lazy initialization
which can perform very well when the user doesn't read the entire tree,
but it also means that a side-effect of reading the tree is that the
structure may be mutated.

[1] http://xml.apache.org/xerces2-j/faq-dom.html#faq-1

On Tue, 28 Oct 2003, Smith, Peter (ELSLON) wrote:

> Hi,
>
> I have a web application that caches DOMs (for site navigation, page layout
> etc..) internally.
>
> I am having problems with exceptions being thrown from within
> org.apache.xerces.dom.DeferredDocumentImpl when reading the DOMs (eg. in a
> xpath operation, when applying a stylesheet)
>
> Some examples of the exceptions that are being thrown:
> - synchronizeData() : NullPointerException
> - getNodeObject() : java.lang.IllegalArgumentException: type: -1
> - getNodeValueString() -> java.util.Vector.elementAt():
> java.lang.ArrayIndexOutOfBoundsException: 4 >= 0
>
> These exceptions only occur when running the application on a multi-cpu
> machine.
>
> Has anyone seen problems like this before?
>
> Using xerces-2.5.0.
>
> Regards,
> Peter Smith
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org