[jira] [Commented] (FOP-3285) NullPointerException in Xerces DOM (fNodeListCache) during concurrent access to newFOP

"Simon Steiner (Jira)" <[email protected]>
Newsgroups gmane.text.xml.fop.devel
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/FOP-3285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18040513#comment-18040513 ] 

Simon Steiner commented on FOP-3285:
------------------------------------

It is not designed to be thread safe

> NullPointerException in Xerces DOM (fNodeListCache) during concurrent access to newFOP 
> ---------------------------------------------------------------------------------------
>
>                 Key: FOP-3285
>                 URL: https://issues.apache.org/jira/browse/FOP-3285
>             Project: FOP
>          Issue Type: Bug
>          Components: renderer/pdf
>            Reporter: Manikanta
>            Priority: Major
>
> I am encountering a concurrency issue when using FOP 2.10 in a multi-threaded Spring Boot environment.
> We initialize a singleton FopFactory using FopFactoryBuilder and a DefaultConfigurationBuilder. When multiple threads attempt to create a new FOP object using factory.newFop(...) simultaneously, the application crashes with a NullPointerException inside Xerces.
> Stack Trace:
> Caused by: java.lang.NullPointerException: Cannot read field "fLength" because "this.fNodeListCache" is null
>     at org.apache.xerces.dom.ParentNode.nodeListGetLength(Unknown Source)
>     at org.apache.fop.configuration.DefaultConfiguration.getChildren(DefaultConfiguration.java:138)
>     at org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
>     ...
> Steps to Reproduce:
> 1. Create a large fop_config.xml with many <font> entries inside a <renderer>.
> 2. Initialize FopFactory once using DefaultConfigurationBuilder  PDF/A3.
> 3. Spawn 20+ threads(more than one is enough IG) that immediately call fopFactory.newFop() and render a PDF.
> Suggested Fix/Workaround:
> Make FopFactory.newFop() threadsafe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.