PDF page export fails with: SandboxCrashedException: Sandbox has crashed while serving the request

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Summary


Try to export a page. The export fails and this message is shown in the page:


Cause
java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "XXXXXXXXXXXXXXXXXXX". <a href="https://docs.atlassian.com/confluence/docs-74/PDF+export+in+Confluence+Data+Center">Learn more</a>
    at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:56)

Diagnosis


The atlassian-confluence.log will show this message:


2019-11-12 14:10:17,231 ERROR [http-nio-8090-exec-4093] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: bc69ccc7d674fa38 | userName: XXXXXX | referer: https://<CONFLUENCE_URL>/page
java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "XXXXXXXXXXXXXXXXXXXXX". <a href="https://docs.atlassian.com/confluence/docs-74/PDF+export+in+Confluence+Data+Center">Learn more</a>
	at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:56)
	at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportSemaphore.run(PdfExportSemaphore.java:28)
	at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.execute(ExportPageAsPdfAction.java:29)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "XXXXXXXXXXXXXXXXXXXXX". <a href="https://docs.atlassian.com/confluence/docs-74/PDF+export+in+Confluence+Data+Center">Learn more</a>
	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:108)
	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:348)
	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdf(SandboxPdfExporterService.java:334)
	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForPage(SandboxPdfExporterService.java:224)
	at com.atlassian.confluence.extra.flyingpdf.impl.DelegatingPdfExporterService.createPdfForPage(DelegatingPdfExporterService.java:54)
	at com.atlassian.confluence.extra.flyingpdf.impl.DiagnosticPdfExporterService.createPdfForPage(DiagnosticPdfExporterService.java:88)
	at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:36)
	... 396 more
Caused by: com.atlassian.confluence.util.sandbox.SandboxCrashedException: Sandbox has crashed while serving the request
	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:230)
	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:159)
	at com.atlassian.confluence.impl.util.sandbox.DefaultSandboxPool.execute(DefaultSandboxPool.java:116)
	at com.atlassian.confluence.impl.util.sandbox.ConfluenceSandboxPoolFactory$LazySandbox.execute(ConfluenceSandboxPoolFactory.java:72)
	at com.atlassian.confluence.impl.util.sandbox.DefaultSandbox.execute(DefaultSandbox.java:36)
	at com.atlassian.confluence.extra.flyingpdf.sandbox.PdfExportSandbox.execute(PdfExportSandbox.java:49)
	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:81)
	... 402 more
Caused by: java.io.EOFException
	at java.io.DataInputStream.readInt(DataInputStream.java:392)
	at com.atlassian.confluence.impl.util.sandbox.SandboxMessage.receiveMessage(SandboxMessage.java:42)
	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.receiveMessage(SandboxProcess.java:283)
	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:156)
	... 407 more


To get even more details, it's possible to increase the PDF Sandbox class to debug:

com.atlassian.confluence.impl.util.sandbox


With the logs in debug, the atlassian-confluence.log will show this message right before the main exception above:

2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:92)
2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:445)
2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at java.awt.image.Raster.createWritableRaster(Raster.java:941)
2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1074)
2020-12-07 15:12:46,961 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at javax.imageio.ImageReader.getDestination(ImageReader.java:2892)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1317)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1614)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at javax.imageio.ImageIO.read(ImageIO.java:1462)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at javax.imageio.ImageIO.read(ImageIO.java:1357)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at com.atlassian.confluence.extra.flyingpdf.impl.LightITextFSImage.getImage(LightITextFSImage.java:193)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextOutputDevice.drawImage(ITextOutputDevice.java:828)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextImageElement.paint(ITextImageElement.java:72)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextOutputDevice.paintReplacedElement(ITextOutputDevice.java:199)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.layout.Layer.paintReplacedElement(Layer.java:540)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.layout.Layer.paintReplacedElements(Layer.java:497)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.layout.Layer.paintAsLayer(Layer.java:471)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.render.BlockBox.paintInline(BlockBox.java:265)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.layout.Layer.paintInlineContent(Layer.java:274)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.layout.Layer.paint(Layer.java:332)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextRenderer.paintPage(ITextRenderer.java:432)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextRenderer.writePDF(ITextRenderer.java:380)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:333)
2020-12-07 15:12:46,962 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$static$0 worker0: 	at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:265)


Cause


The PDF export is processed by Confluence in a separated Java process to avoid problems with the main Confluence process. The Sandbox process has a limited memory to use. By default the process can use up to 512 MB, however, depending on the page size and complexity, this amount of memory is not enough, causing the Sandbox to crash during the export.

Solution

  1. If the affected page has a Draw.io diagrams and the version is 9.15.0 or lower, update it to the latest version
  2. Increase the memory available for the Sandbox with the parameter conversion.sandbox.memory.limit.megabytes as described in Configuring System Properties.




Last modified on Dec 29, 2020

Was this helpful?

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