Discussion:
[jira] [Created] (FOP-2745) Multi-threaded initialization fails
(too old to reply)
Jochen Kemnade (JIRA)
2017-09-29 07:32:00 UTC
Permalink
Jochen Kemnade created FOP-2745:
-----------------------------------

Summary: Multi-threaded initialization fails
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade


When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
simon steiner (JIRA)
2017-10-03 09:43:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189466#comment-16189466 ]

simon steiner commented on FOP-2745:
------------------------------------

Can you provide replication steps
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Jochen Kemnade (JIRA)
2017-10-04 06:57:01 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16190887#comment-16190887 ]

Jochen Kemnade commented on FOP-2745:
-------------------------------------

{code:java}
public static void main(final String[] args) throws Exception {
ResourceResolver resourceResolver = ResourceResolverFactory.createDefaultResourceResolver();
FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new File(".").getAbsoluteFile().toURI(),
resourceResolver);
FopFactory fopFactory = fopFactoryBuilder.build();

int numberOfThreads = 10;

List<Thread> threads = new ArrayList<>(numberOfThreads);
for (int i = 0; i < numberOfThreads; i++) {
Thread t = new Thread(new Runnable() {

@Override
public void run() {
try (OutputStream out = new ByteArrayOutputStream()) {
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
} catch (FOPException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});
threads.add(t);
t.start();
}
for (Thread t : threads) {
t.join();
}
}
{code}
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
simon steiner (JIRA)
2017-10-04 07:47:01 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16190928#comment-16190928 ]

simon steiner commented on FOP-2745:
------------------------------------

FopFactory shouldnt be shared across threads
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Jochen Kemnade (JIRA)
2017-10-04 07:58:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16190942#comment-16190942 ]

Jochen Kemnade commented on FOP-2745:
-------------------------------------

Alright, but using a new instance in every thread doesn't change anything about this particular error.
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Pontus (JIRA)
2018-10-01 08:02:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633689#comment-16633689 ]

Pontus commented on FOP-2745:
-----------------------------

This is because of an initialization error in AWT. You can read more about it here: [https://bugs.openjdk.java.net/browse/JDK-8058973]

The code that I have been using is something along the lines of:

 
{code:java}
private final Object icc_colors_lock = new Object();
private boolean icc_colors_initialized = false;

private Fop getFop() {
synchronized (this.icc_colors_lock) {
if (this.icc_colors_initialized == false) {

// We need to do this in a synchronized block before any real call.
// This is because of: https://bugs.openjdk.java.net/browse/JDK-8058973
// It will only happen if the ICC color profiles have not been cached before.
// This is very rare, but might occur in test cases, or if no other image processing has been done yet since startup.
// Should be rare, but this might solidify the safety of using the FopFactory.
Fop unused = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new ByteArrayOutputStream());
this.icc_colors_initialized = true;
}
}

return fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
}{code}
 

 
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
Priority: Major
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
Pontus (JIRA)
2018-10-01 08:03:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633689#comment-16633689 ]

Pontus edited comment on FOP-2745 at 10/1/18 8:02 AM:
------------------------------------------------------

This is because of an initialization error in AWT. You can read more about it here: [https://bugs.openjdk.java.net/browse/JDK-8058973]

The code that I have been using is something along the lines of:

 
{code:java}
private final Object icc_colors_lock = new Object();
private boolean icc_colors_initialized = false;

private Fop getFop() {
synchronized (this.icc_colors_lock) {
if (this.icc_colors_initialized == false) {

// We need to do this in a synchronized block before any real call.
// This is because of: https://bugs.openjdk.java.net/browse/JDK-8058973
// It will only happen if the ICC color profiles have not been cached before.
// This is very rare, but might occur in test cases,
// or if no other image processing has been done yet since startup.
// Should be rare, but this might solidify the safety of using the FopFactory.
Fop unused = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new ByteArrayOutputStream());
this.icc_colors_initialized = true;
}
}

return fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
}{code}
 

 


was (Author: eliason):
This is because of an initialization error in AWT. You can read more about it here: [https://bugs.openjdk.java.net/browse/JDK-8058973]

The code that I have been using is something along the lines of:

 
{code:java}
private final Object icc_colors_lock = new Object();
private boolean icc_colors_initialized = false;

private Fop getFop() {
synchronized (this.icc_colors_lock) {
if (this.icc_colors_initialized == false) {

// We need to do this in a synchronized block before any real call.
// This is because of: https://bugs.openjdk.java.net/browse/JDK-8058973
// It will only happen if the ICC color profiles have not been cached before.
// This is very rare, but might occur in test cases, or if no other image processing has been done yet since startup.
// Should be rare, but this might solidify the safety of using the FopFactory.
Fop unused = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new ByteArrayOutputStream());
this.icc_colors_initialized = true;
}
}

return fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
}{code}
 

 
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
Priority: Major
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
Pontus (JIRA)
2018-10-01 08:05:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/FOP-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633689#comment-16633689 ]

Pontus edited comment on FOP-2745 at 10/1/18 8:04 AM:
------------------------------------------------------

This is, as said earlier, because of an initialization error in AWT ([https://bugs.openjdk.java.net/browse/JDK-8058973])

The code that I have been using is something along the lines of:
{code:java}
private final Object icc_colors_lock = new Object();
private boolean icc_colors_initialized = false;

private Fop getFop() {
synchronized (this.icc_colors_lock) {
if (this.icc_colors_initialized == false) {

// We need to do this in a synchronized block before any real call.
// This is because of: https://bugs.openjdk.java.net/browse/JDK-8058973
// It will only happen if the ICC color profiles have not been cached before.
// This is very rare, but might occur in test cases,
// or if no other image processing has been done yet since startup.
// Should be rare, but this might solidify the safety of using the FopFactory.
Fop unused = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new ByteArrayOutputStream());
this.icc_colors_initialized = true;
}
}

return fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
}{code}
 

 


was (Author: eliason):
This is because of an initialization error in AWT. You can read more about it here: [https://bugs.openjdk.java.net/browse/JDK-8058973]

The code that I have been using is something along the lines of:

 
{code:java}
private final Object icc_colors_lock = new Object();
private boolean icc_colors_initialized = false;

private Fop getFop() {
synchronized (this.icc_colors_lock) {
if (this.icc_colors_initialized == false) {

// We need to do this in a synchronized block before any real call.
// This is because of: https://bugs.openjdk.java.net/browse/JDK-8058973
// It will only happen if the ICC color profiles have not been cached before.
// This is very rare, but might occur in test cases,
// or if no other image processing has been done yet since startup.
// Should be rare, but this might solidify the safety of using the FopFactory.
Fop unused = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new ByteArrayOutputStream());
this.icc_colors_initialized = true;
}
}

return fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
}{code}
 

 
Post by Jochen Kemnade (JIRA)
Multi-threaded initialization fails
-----------------------------------
Key: FOP-2745
URL: https://issues.apache.org/jira/browse/FOP-2745
Project: FOP
Issue Type: Bug
Affects Versions: 2.2
Reporter: Jochen Kemnade
Priority: Major
When multiple thread initialize FOP, some of them are likely to throw a {{NullPointerException}} or {{ConcurrentModificationException}}.
{noformat}
java.lang.NullPointerException: null
at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
at org.apache.fop.pdf.PDFICCBasedColorSpace.<init>(PDFICCBasedColorSpace.java:49)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1453)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
or
{noformat}
java.util.ConcurrentModificationException: null
at java.util.Vector$Itr.checkForComodification(Vector.java:1184)
at java.util.Vector$Itr.next(Vector.java:1137)
at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1359)
at org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil.getICCProfileDescription(ColorProfileUtil.java:46)
at org.apache.fop.pdf.PDFResources.addColorSpace(PDFResources.java:160)
at org.apache.fop.pdf.PDFFactory.makeICCBasedColorSpace(PDFFactory.java:1460)
at org.apache.fop.pdf.PDFICCBasedColorSpace.setupsRGBAsDefaultRGBColorSpace(PDFICCBasedColorSpace.java:116)
at org.apache.fop.render.pdf.PDFRenderingUtil.addsRGBColorSpace(PDFRenderingUtil.java:187)
at org.apache.fop.render.pdf.PDFRenderingUtil.setupPDFDocument(PDFRenderingUtil.java:604)
at org.apache.fop.render.pdf.PDFDocumentHandler.startDocument(PDFDocumentHandler.java:159)
at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.startDocument(IFDocumentHandlerProxy.java:105)
at org.apache.fop.render.intermediate.IFRenderer.startRenderer(IFRenderer.java:263)
at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:81)
at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363)
at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
at org.apache.fop.apps.Fop.<init>(Fop.java:78)
at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:182)
{noformat}
The underlying is https://bugs.openjdk.java.net/browse/JDK-8058973.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Loading...