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

"Manikanta (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=18040504#comment-18040504 ] 

Manikanta commented on FOP-3285:
--------------------------------

Sorry for the late reply.

I realize that creating a new {{FopFactory}} for every thread would likely fix this, but I want to understand the intended design. Is {{FopFactory}} supposed to be thread-safe? I cannot find any documentation explicitly stating that it must be thread-confined.

Since this issue occurs only intermittently under high load, simply failing to reproduce the crash doesn't prove it is fixed. I need to confirm the root cause to be 100% certain that the solution is robust

> 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.