Manikanta created FOP-3285:
------------------------------

             Summary: NullPointerException in Xerces DOM (fNodeListCache) 
during concurrent access to Renderer Configuration
                 Key: FOP-3285
                 URL: https://issues.apache.org/jira/browse/FOP-3285
             Project: FOP
          Issue Type: Bug
          Components: renderer/pdf
            Reporter: Manikanta


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)

Reply via email to