大規模な Confluence スペースについては PDF エクスポートが完了しない
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
Exporting a Confluence Space with thousands of pages to PDF runs indefinitely.
診断
The PDF space export on the Confluence web UI hangs at 99% completion. Confluence application logs show the following error:
2023-08-29 10:25:28,151 ERROR [Long running task: PDF Space Export] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "PDF Space Export" failed to run.
-- url: /confluence/spaces/flyingpdf/doflyingpdf.action | referer: https://confluence.atlassian.test/confluence/spaces/flyingpdf/flyingpdf.action?key=TROL | traceId: b38cee07ad805b93 | userName: admin | action: doflyingpdf
java.lang.StackOverflowError
at java.base/java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:73)
at jdk.internal.reflect.GeneratedMethodAccessor1481.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
This error can be addressed by increasing the Java stack size to 8MB. Once this setting is applied and the PDF space export is attempted again, unfortunately there will be another failure which will not state a clear reason:
2023-08-29 11:01:08,727 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://confluence.atlassian.test/confluence/spaces/flyingpdf/flyingpdf.action?key=TROL | traceId: b659c6e71ea0efe0 | 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>
[...]
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)
at com.atlassian.confluence.impl.util.sandbox.SandboxLocalProcessPool.execute(SandboxLocalProcessPool.java:107)
at com.atlassian.confluence.impl.util.sandbox.ConfluenceSandboxPoolFactory$LazySandbox.execute(ConfluenceSandboxPoolFactory.java:70)
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:83)
... 57 more
Caused by: java.io.EOFException
at java.base/java.io.DataInputStream.readInt(DataInputStream.java:397)
at com.atlassian.confluence.impl.util.sandbox.SandboxMessage.receiveMessage(SandboxMessage.java:43)
at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.receiveMessage(SandboxProcess.java:227)
at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:136)
To understand why the conversion sandbox process failed the package com.atlassian.confluence.impl.util.sandbox need to be set at DEBUG level. After increasing the logging level and repeating the PDF space export, Confluence application logs will show the error that made the sandbox process crash:
2023-08-29 11:23:44,352 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker0: Exception in thread "main" java.lang.StackOverflowError
2023-08-29 11:23:44,352 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker0: at java.base/java.io.ObjectInputStream.readHandle(ObjectInputStream.java:1801)
2023-08-29 11:23:44,352 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker0: at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInput
The reason of the sandbox process failure is again a StackOverflowError, this happens because the sandbox process does not inherit the stack size setting from Confluence and need the property conversion.sandbox.stack.limit.megabytes to be set accordingly.
原因
The serialisation of the pages in the space exceed the Confluence Java Stack default size of 2MB.
ソリューション
Increase the Java stack size for both Confluence and the conversion Sandbox process by adding the following Java System properties:
-Xss8m -Dconversion.sandbox.stack.limit.megabytes=8
and then rolling restart all Confluence nodes in the cluster.
Please be aware that 8MB for the Java Stack size helped with a space with around 3700 pages. A different value may be a better setting for a space of different size.