PDF Space export fails at 99% with a StackOverflowError while converting the page "Table of contents"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Executing a PDF Space Export fails at 99% while converting the page "Table of contents"

Environment

Confluence 7.19.X and Confluence 8.X

Diagnosis

In the Confluence UI, the following error will be reported at 99% completion of the PDF Space export process: 

When configuring additional DEBUG logging for the Sandbox class ( com.atlassian.confluence.impl.util.sandbox ), the following can be observed in the atlassian-confluence.log  file: 

2024-05-28 02:50:30,068 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1: Exception in thread "main" java.lang.StackOverflowError
2024-05-28 02:50:30,068 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1:       at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1722)
2024-05-28 02:50:30,068 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1:       at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)
2024-05-28 02:50:30,068 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1:       at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2390)
2024-05-28 02:50:30,068 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1:       at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2228)
...
...
2024-05-28 02:50:34,312 ERROR [Long running task: PDF Space Export] [core.task.longrunning.AbstractLongRunningTask] lambda$doRunInternal$0 Error during PDF export
 -- url: /confluence/spaces/flyingpdf/doflyingpdf.action | referer: https://linux-71919.prod.atl-cd.net/confluence/spaces/flyingpdf/flyingpdf.action?key=ICONICCLGE | traceId: da9dcbab95afb191 | userName: admin | action: doflyingpdf
com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Table of contents". <a href="https://docs.atlassian.com/confluence/docs-719/PDF+export+in+Confluence+Data+Center">Learn more</a>
        at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:95)
        at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:354)
        at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.generateTableOfContents(SandboxPdfExporterService.java:204)
        at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForSpace(SandboxPdfExporterService.java:148)
        at com.atlassian.confluence.extra.flyingpdf.impl.DelegatingPdfExporterService.createPdfForSpace(DelegatingPdfExporterService.java:49)
        at com.atlassian.confluence.extra.flyingpdf.impl.BigBrotherPdfExporterService.createPdfForSpace(BigBrotherPdfExporterService.java:96)
...
...


Cause

As part of the PDF generation, it is created implicitly a table of contents in the PDF document. If the space is very large with numerous pages, the "Table of contents" page may require a bigger Stack size to be generated successfully. 

Solution

Increase the stack size of the JVM processes running Confluence and the Sandbox, but adding the following System properties in your setenv.sh  file: 

-Xss8m -Dconversion.sandbox.stack.limit.megabytes=8

(info) If the error keeps happening, you will need to the increase the stack size in Confluence/Sandbox even higher. 

Do remember to restart Confluence to ensure the changes take effect. 

Last modified on Jun 3, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.