You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/09/04 16:06:00 UTC
[jira] [Closed] (PDFBOX-3015) PDICCBased loadICCProfile() throwing
ConcurrentModificationException
[ https://issues.apache.org/jira/browse/PDFBOX-3015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr closed PDFBOX-3015.
-----------------------------------
Resolution: Duplicate
Closing as duplicate of PDFBOX-3267. [~jasonmackin] if it is still happening, please reopen. If possible, attach a PDF file.
> PDICCBased loadICCProfile() throwing ConcurrentModificationException
> --------------------------------------------------------------------
>
> Key: PDFBOX-3015
> URL: https://issues.apache.org/jira/browse/PDFBOX-3015
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.0
> Environment: Windows 8.1 Pro
> java 6-8
> tomcat 6-7
> Reporter: Jason Mackin
>
> When running a load test using PDFRenderer's method renderImageWithDPI(pageIndex, 175), I am receiving a ConcurrentModificationException. I only receive this using Java 6-8 and Tomcat 6 or 7 but Tomcat 8 seems to work. I can reproduce this with as little as 4 concurrent threads kicked off at the same time. It only happens the first time the method is called (server startup), after that it works fine.
> Here is the stacktrace:
> {quote}
> java.util.ConcurrentModificationException
> at java.util.Vector$Itr.checkForComodification(Vector.java:1156)
> at java.util.Vector$Itr.next(Vector.java:1133)
> at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
> at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:775)
> at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:1013)
> at org.apache.pdfbox.pdmodel.graphics.color.PDICCBased.loadICCProfile(PDICCBased.java:119)
> at org.apache.pdfbox.pdmodel.graphics.color.PDICCBased.<init>(PDICCBased.java:89)
> at org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.create(PDColorSpace.java:162)
> at org.apache.pdfbox.pdmodel.PDResources.getColorSpace(PDResources.java:155)
> at org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace.process(SetStrokingColorSpace.java:41)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:799)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:461)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:438)
> at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:180)
> at org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:80)
> {quote}
> Since the problem was with a java class not being synchronized, I added a simple static synchronized method to PDICCBased.java to load the profile and prevent the race condition:
> {quote}
> private static synchronized ICC_Profile getICCProfile(InputStream input) throws IOException \{
> return ICC_Profile.getInstance(input);
> \}
> {quote}
> And call it from the loadICCProfile method:
> {quote}
> ICC_Profile profile = PDICCBased.getICCProfile(input);
> {quote}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org