Export to PDF gets stuck trying to download external images

XMLWordPrintable

    • 21
    • Severity 3 - Minor
    • 4

      Issue Summary

      Customer reports that he is unable to export a specific page to PDF. Gets the stack trace bellow:

      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:52)
      
      caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:81)
      
      caused by: com.atlassian.confluence.util.sandbox.SandboxTimeoutException: Sandbox request has been killed because it exceeded time limit of 180 seconds
      at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:227)
      
      caused by: java.io.IOException: Stream closed
      at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
      

      It was found in the page storage format that it contained external images, but they were not visible in the page for reading or editing.

      Steps to Reproduce

      1. Page storage format contains the following lines
        <ac:image ac:class="caui-wait" ac:alt="Wait"><ri:url ri:value="https://<external site URL>/images/s.gif" /></ac:image>
        <ac:image ac:class="caui-wait" ac:alt="Wait"><ri:url ri:value="<external site URL>/images/s.gif" /></ac:image>
        
      2. Try to export to PDF

      Expected Results

      Page exported properly

      Actual Results

      Customer gets timeout error:

      020-05-20 09:51:15,977 WARN [http-nio2-8011-exec-176] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:
        ->[null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #1994390836)
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 16a4d71ffa52dd3d | userName: <user> | referer: https://<page URL>
      2020-05-20 09:51:15,978 ERROR [http-nio2-8011-exec-176] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 16a4d71ffa52dd3d | userName: <user> | referer: https://<page URL>
      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:52)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportSemaphore.run(PdfExportSemaphore.java:24)
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.execute(ExportPageAsPdfAction.java:25)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)
      	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      	at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:33)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      ...
      	at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
      	at sun.nio.ch.Invoker$2.run(Invoker.java:218)
      	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:81)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:321)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdf(SandboxPdfExporterService.java:307)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForPage(SandboxPdfExporterService.java:206)
      	at com.atlassian.confluence.extra.flyingpdf.DelegatingPdfExporterService.createPdfForPage(DelegatingPdfExporterService.java:61)
      	at com.atlassian.confluence.extra.flyingpdf.DiagnosticPdfExporterService.createPdfForPage(DiagnosticPdfExporterService.java:74)
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:32)
      	... 394 more
      Caused by: com.atlassian.confluence.util.sandbox.SandboxTimeoutException: Sandbox request has been killed because it exceeded time limit of 180 seconds
      	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:227)
      	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:41)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:61)
      	... 400 more
      Caused by: java.io.IOException: Stream closed
      	at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
      	at java.io.BufferedInputStream.fill(BufferedInputStream.java:214)
      	at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
      	at java.io.DataInputStream.readInt(DataInputStream.java:388)
      	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)
      	... 405 more
      2020-05-20 09:51:15,982 WARN [http-nio2-8011-exec-176] [confluence.util.profiling.DefaultActivityMonitor] close Exceeded the threshold of 60000 ms: ActivitySnapshot{startTime=1589982495563, threadId=246526, threadName='http-nio2-8011-exec-176', userId='<user>', type='web-request', summary='/spaces/flyingpdf/pdfpageexport.action?pageId=<pageid>'}
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 16a4d71ffa52dd3d | userName: <user> | referer: https://<page URL>
      2020-05-20 09:51:16,015 INFO [http-nio2-8011-exec-176] [atlassian.confluence.status.SystemErrorInformationLogger] writeToLog 
      Request Unique ID : f4ca9720-b3c6-45ce-bd67-99772fc0b073
      --------------------------
      JVM Stats
      --------------------------
      usedMemory = 5479196696
      usedMemoryInMegabytes = 5225
      availableHeap = 5258221544
      freeMemoryInMegabytes = 5014
      allocatedHeap = 10737418240
      freeAllocatedHeap = 5258221544
      totalMemory = 10737418240
      totalMemoryInMegabytes = 10240
      availablePermGen = 0
      maxPermGen = -1
      maxHeap = 10737418240
      usedHeap = 5479196696
      freeMemory = 5258221544
      usedPermGen = -1
      --------------------------
      Request Information
      --------------------------
      URL: https://<url>/500page.jsp
      Scheme: https
      Server: <conf url>
      Port: 443
      URI: /500page.jsp
      Context Path: 
      Servlet Path: /500page.jsp
      Path Info: null
      Query String: pageId=<pageid>
      --------------------------
      Attributes
      --------------------------
      javax.servlet.forward.request_uri: /spaces/flyingpdf/pdfpageexport.action
      javax.servlet.forward.context_path: 
      javax.servlet.forward.servlet_path: /spaces/flyingpdf/pdfpageexport.action
      javax.servlet.forward.query_string: pageId=<pageid>
      javax.servlet.forward.mapping: org.apache.catalina.core.ApplicationMapping$MappingImpl@5150bb26
      javax.servlet.error.status_code: 500
      com.atlassian.confluence.impl.profiling.DecoratorTimings: com.atlassian.confluence.impl.profiling.DecoratorTimings@7f75c544
      com.opensymphony.sitemesh.APPLIED_ONCE: true
      __cleanup_recursion_counter: 0
      com.atlassian.confluence.util.message.MessagesDecoratorFilter__already_filtered__: true
      com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter_already_filtered: true
      atlassian.core.seraph.original.url: /500page.jsp?pageId=<pageid>
      com.atlassian.labs.botkiller.BotKillerFilter: true
      com.atlassian.gzipfilter.GzipFilter_already_filtered: true
      Confluence-Request-Time: 1589982495553
      com.atlassian.confluence.web.ConfluenceJohnsonFilter_already_filtered: true
      com.atlassian.seraph.auth.LoginReason: OK
      confluence.messages: {websudo-message=com.atlassian.confluence.security.websudo.WebSudoMessage@6044c346}
      bigpipe.macro.execution.flag: []
      webwork.valueStack: com.opensymphony.xwork.util.OgnlValueStack@7f4664b2
      confluence.themecontext: com.atlassian.confluence.themes.ThemeContext@2b1b79f7
      javax.servlet.error.message: 
      javax.servlet.error.servlet_name: action
      com.opensymphony.sitemesh.USINGSTREAM: false
      B3-TraceId: 2f63cdd1f7540e
      loginfilter.already.filtered: true
      javax.servlet.jsp.jspException: java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      javax.servlet.error.request_uri: /spaces/flyingpdf/pdfpageexport.action
      com.atlassian.core.filters.HeaderSanitisingFilter_already_filtered: true
      com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFixupFilter: true
      com.comalatech.pageapprovals: com.comalatech.confluence.workflow.DefaultWorkflowAccessor$PageWorkflowsContainer@7a15c635
      javax.servlet.error.exception: java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      os_securityfilter_already_filtered: true
      com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter: true
      com.atlassian.confluence.util.profiling.ConfluenceProfilingStrategy.splits: []
      --------------------------
      Parameters
      --------------------------
      pageId : <pageid>
      caused by: java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:52)
      caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. The page "<page title>" took too long to convert. <a href="https://docs.atlassian.com/confluence/docs-613/PDF+export+in+Confluence+Data+Center">Learn more</a>
      at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:81)
      caused by: com.atlassian.confluence.util.sandbox.SandboxTimeoutException: Sandbox request has been killed because it exceeded time limit of 180 seconds
      at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:227)
      caused by: java.io.IOException: Stream closed
      at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
      

      Thread dumps of the Sandbox shows the following stuck thread:

      org.xhtmlrenderer.pdf.ITextReplacedElementFactory.createReplacedElement(ITextReplacedElementFactory.java:59)
      	at org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:716)
      	at org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:666)
      	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:809)
      	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:776)
      	at org.xhtmlrenderer.layout.InlineBoxing.layoutInlineBlockContent(InlineBoxing.java:421)
      	at org.xhtmlrenderer.layout.InlineBoxing.layoutContent(InlineBoxing.java:318)
      	at org.xhtmlrenderer.render.BlockBox.layoutInlineChildren(BlockBox.java:983)
      	at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:964)
      	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:847)
      	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:776)
      	at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
      	at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
      	at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
      	at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:967)
      

      Workaround

      Edit the page using the Confluence Source Editor, and remove the references to the images

            Assignee:
            Franco Skrzypczak (Inactive)
            Reporter:
            Edson (Inactive)
            Votes:
            9 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: