[
https://issues.apache.org/jira/browse/XGC-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849530#comment-16849530
]
Allan Andersen commented on XGC-120:
------------------------------------
The FopFactory is per instance and is never reused.
But I think the problem is that the ImageImplRegistry has a static
getDefaultInstance() method which is used by the ImageManager which means that
the threads are accessing the same lists/maps at the ImageImplRegistry.
The FopFactoryBuilder uses the single argument contructor on the ImageManger
which results in the same ImageImplRegistry which isn't threadsafe.
> java.util.ConcurrentModificationException in ImageImplregistry iterator
> -----------------------------------------------------------------------
>
> Key: XGC-120
> URL: https://issues.apache.org/jira/browse/XGC-120
> Project: XMLGraphicsCommons
> Issue Type: Bug
> Affects Versions: 2.3
> Environment: Ubuntu
> Reporter: Allan Andersen
> Priority: Major
>
> I get this ConcurrentModificationException when running a multithreaded
> testcase.
> The problem is related to the preloaders (ArrayList) in ImageImplRegistry
> which isn't threadsafe. Using CopyOnWriteArrayList is a quick solution to the
> issue.
> The other lists/maps are using the same non-threadsafe implementations.
> CopyOnWriteArrayList and ConcurrentHashMap works better.
> {code:java}
> Stacktrace:
> Caused by: java.util.ConcurrentModificationException
> at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
> at java.util.ArrayList$Itr.next(ArrayList.java:859)
> at
> org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry$MyIterator.next(ImageImplRegistry.java:267)
> at
> org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:175)
> at
> org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:127)
> at
> org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)
> at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
> at org.apache.fop.fo.FObj.processNode(FObj.java:126)
> at
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)
> at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179)
> at
> org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
> at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
> Source)
> at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at
> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]