[
https://issues.apache.org/jira/browse/FOP-2970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623206#comment-17623206
]
Oliver Kaiser commented on FOP-2970:
------------------------------------
Sure I can share it, but it's a proof-of-concept hack.
- CachedUserConfiguration is not really safe (volatile or AtomicReference for
members?)
- it seems to work for the configs we use; but I don't know if FOP can do funky
stuff (modify config at runtime; is there a reason why it is mutable?)
- haven't been able to create a reliable testcase for the race condition; seems
to break in maybe 1/10k runs, sometimes 100k runs work fine; thus not sure if
the fix is good, just haven't been able to break it with those changes
[^fop-2970_hack.txt]
- this is really ugly
for production have downgraded fop to 2.3; if no better solution is forthcoming
will probably create a fork to avoid the workarounds; but really don't want to
do that.
> Exception when loading the config
> ---------------------------------
>
> Key: FOP-2970
> URL: https://issues.apache.org/jira/browse/FOP-2970
> Project: FOP
> Issue Type: Bug
> Reporter: zouari
> Priority: Major
> Attachments: fop-2970_hack.txt
>
>
> Starting with FOP 2.4 the avalon framework is not used anymore.
> Instead, a Configuration implementation has been added to the FOP:
> org.apache.fop.configuration.DefaultConfiguration
> this new implementation uses the library "xercesImpl-2.11.0.jar" (not
> thread-safe ).
> In multithreaded applications, I have the following exception:
> {code:java}
> Caused by: java.lang.NullPointerException
> at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source)
> at org.apache.xerces.dom.ParentNode.item(Unknown Source)
> at
> org.apache.fop.configuration.DefaultConfiguration.getChild(DefaultConfiguration.java:113)
>
> at
> org.apache.fop.apps.FOUserAgent.getRendererConfiguration(FOUserAgent.java:696)
>
> at
> org.apache.fop.apps.FOUserAgent.getRendererConfig(FOUserAgent.java:673)
> at
> org.apache.fop.render.PrintRendererConfigurator.getRendererConfig(PrintRendererConfigurator.java:91)
>
> at
> org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
>
> at
> org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
>
> at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
> at
> org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
>
> at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:79)
> at
> org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:150)
> at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:113)
> at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:132)
> at
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.<init>(PageSequenceLayoutManager.java:136)
>
> at
> org.apache.fop.layoutmgr.LayoutManagerMapping.makePageSequenceLayoutManager(LayoutManagerMapping.java:205)
>
> at
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:290)
> at
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:158)
> at
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:362)
>
> at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
> at
> org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
>
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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
(v8.20.10#820010)