Exporting a page or space to PDF throws a system error in browser, SandboxCrashedException in logs due to OpenTelemetry Java Agent
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
Exporting a page or space to PDF causes a System Error and SandboxCrashedException due to an OpenTelemetry Java Agent running on the same server.
Environment
Confluence 8+
Diagnosis
When exporting a page or space to PDF, the following system error is thrown in the browser instantly:
A system error has occurred - our apologies!
For immediate troubleshooting, consult our knowledge base for a solution.
If you would like to receive support from Atlassian's support team, ask your Confluence administrator to create a support issue on Atlassian's support system with the following information:
a description of your problem and what you were doing at the time it occurred
a copy of the error and system information found below
a copy of the application logs (if possible).
Your Confluence administrator can use the support request form to create a support ticket which will include this information.We will respond as promptly as possible.
Thank you!Return to site homepage…
Cause
Exception ID: ce33aba1-071f-4e53-b4f7-136be00b68c9Referer URL
Upon checking the atlassian-confluence.log, the following SandboxCrashedException can be seen:
2024-06-10 14:11:51,053 ERROR [http-nio-8090-exec-6 url: /confluence/spaces/flyingpdf/pdfpageexport.action; user: XXXXX] [apache.struts2.dispatcher.DefaultDispatcherErrorHandler] sendErrorResponse Exception occurred during processing request: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page \"Test Page\". <a href=\"https://docs.atlassian.com/confluence/docs-85/PDF+export+in+Confluence+Data+Center\">Learn more</a>
-- url: /confluence/spaces/flyingpdf/pdfpageexport.action | userName: XXXXXX | referer: https://xxx.xxxxxx.com/confluenceqa/display/XXX/Test+Page | traceId: db691283a5fab2f6
java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test Page". <a href="https://docs.atlassian.com/confluence/docs-85/PDF+export+in+Confluence+Data+Center">Learn more</a>
at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:57)
.
.
Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test Page". <a href="https://xxx.xxxxxx.com/confluence/docs-85/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)
.
.
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:174)
at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:139)
.
.
Caused by: java.io.EOFException
at java.base/java.io.DataInputStream.readInt(Unknown Source)
at com.atlassian.confluence.impl.util.sandbox.SandboxMessage.receiveMessage(SandboxMessage.java:43)
You can additionally enable debug logging on the class com.atlassian.confluence.impl.util.sandbox in the Configuring Logging section and reproduce the issue. The following exception pertaining to OpenTelemetry Java Agent will then occur in the atlassian-confluence.log.
2024-06-12 06:13:33,069 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker0: Caused by: java.lang.ExceptionInInitializerError: Exception java.util.ServiceConfigurationError: org.apache.logging.log4j.core.util.ContextDataProvider: Provider io.opentelemetry.javaagent.shaded.instrumentation.log4j.contextdata.v2_17.OpenTelemetryContextDataProvider not found [in thread \"main\"]
Cause
OpenTelemetry Java Agent causes the Sandbox (See more about Sandboxes at: External Process Pool for Confluence Data Center) to crash at the OS level. As the external Sandbox processes handle the PDF exports in Confluence, a Sandbox crash results in the system error during PDF export.
OpenTelemetry java agents can be used for application monitoring and are present as a process in the OS level.
Solution
Remove the OpenTelemetry Java Agent that caused the failure. As the OpenTelemetry Java agent process runs on an OS level, we recommend to work with your server admin team to identify the process that needs to be removed.
Once the OpenTelemetry Java Agent is removed, the PDF page & space exports should be completed successfully.