Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.4.1
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
JDK version and platform:Java HotSpot Server VM "1.6.0_07"; Linux
Description
I get a ConcurrentModificationException when using DefaultConverterLookup from multiple threads. The reason is that accesses to the 'converters' list are not synchronized. I attach a minimal example to reproduce the problem. Executing it sometimes leads to the exception (see stack trace below).
Thanks for fixing this issue!
Exception in thread "Thread-13791" java.util.ConcurrentModificationException
at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1100)
at java.util.TreeMap$KeyIterator.next(TreeMap.java:1154)
at com.thoughtworks.xstream.core.util.PrioritizedList$PrioritizedItemIterator.next(PrioritizedList.java:91)
at com.thoughtworks.xstream.core.DefaultConverterLookup.flushCache(DefaultConverterLookup.java:78)
at MinimalDefaultConverterLookupTest$2.run(MinimalDefaultConverterLookupTest.java:26)
This is also by design. XStream's documentation clearly states that the configuration is not threadsafe, only the usage resp. lookup. You may never register converters in parallel.