Torsten Kuhnhenne created XGC-117:
-------------------------------------
Summary: ConcurrentModificationException in ImageCache /
ImageCache not thread-safe
Key: XGC-117
URL: https://issues.apache.org/jira/browse/XGC-117
Project: XMLGraphicsCommons
Issue Type: Bug
Components: general
Affects Versions: 2.3
Reporter: Torsten Kuhnhenne
When using a single {{FopFactory}} to create multiple {{Fop}} instances that
are used in different threads I get an {{ConcurrentModificationException}} in
{{ImageCache#doInvalidURIHouseKeeping}} in line 294.
Source of the problem is the that new HashSet(this.invalidURIs.keySet())
internaly iterates over the key-set that is backed by the {{HashMap}} and when
another thread changes the {{HashMap}} the {{ConcurrentModificationException}}
occurs.
In my opinion there must be synchronized-blocks around each access of the
{{invalidURIs}} map to solve this problem. The use of a synchronized map can
not solve this problem.
Stacktrace:
{code:java}
Caused by: java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1437)
at java.util.HashMap$KeyIterator.next(HashMap.java:1461)
at java.util.AbstractCollection.addAll(AbstractCollection.java:343)
at java.util.HashSet.<init>(HashSet.java:119)
at
org.apache.xmlgraphics.image.loader.cache.ImageCache.doInvalidURIHouseKeeping(ImageCache.java:294)
at
org.apache.xmlgraphics.image.loader.cache.ImageCache.doHouseKeeping(ImageCache.java:290)
at
org.apache.xmlgraphics.image.loader.cache.ImageCache.considerHouseKeeping(ImageCache.java:280)
at
org.apache.xmlgraphics.image.loader.cache.ImageCache.registerInvalidURI(ImageCache.java:209)
at
org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:130)
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)
{code}
The issue XGC-30 sounds similiar but does not solve the problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]