I isolated the concurrency failures to two places.  First, SAXParserFactories are not 
guaranteed to be thread-safe, so I synchronized the saxFactory.newSAXParser() call.

Second, and much more major - we are apparently "sharing" instances of 
SimpleDeserializers....?!?  I don't understand how this could work in a multi-threaded 
environment, when each deserializer is maintaining a StringBuffer collecting values 
from deserialized XML....

I propose we remove all of the code related to sharing deserializers.  Serializers may 
be shared, since they don't have state, but Deserializers must be created on a 
per-instance basis, or must be redesigned to hold state in TLS or some other 
thread-safe place.  I may be missing something here, so please fill me in if you think 
this is an incorrect analysis.  I will note that turning off sharing in all cases has 
fixed the concurrency test problems.

Sorry for not noticing and commenting on this earlier.

--Glen

Reply via email to