Excessive <ul><li> tags causing PDF Export to Fail and CPU spike

XMLWordPrintable

    • 32
    • Severity 3 - Minor
    • 60

      An unordered list created with excessive <ul><li> tags causes PDF generation to fail for the page

      • Sandbox crashes if sandbox process generation is enabled
      • OOM issue observed in the logs
      • CPU utilization> 100

      Recreation Steps

      1. Create a new page
      2. Create an unordered list by pressing Tab multiple Times (storage format attached for sample page)
      3. Create a PDF export
      4. Issue can be reproduced irrespective of whether sandbox generation is enabled or disabled

      Storage Format

      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li style="list-style-type: none;">
      <ul>
      <li>Test Page</li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul> 

      Expected Results

      PDF export successful without issues

      Actual Results

      PDF generation fails with below error

      CPU spikes

      Error in the logs

       -- url: /confluence/spaces/flyingpdf/pdfpageexport.action | userName: admin | referer: https://linux-56273.prod.atl-cd.net/confluence/display/PD/Test | traceId: 5b093dbebd82045c
      2023-11-05 09:47:34,167 ERROR [http-nio-8090-exec-3 url: /confluence/spaces/flyingpdf/pdfpageexport.action; user: admin] [apache.struts2.dispatcher.DefaultDispatcherErrorHandler] sendErrorResponse Exception occurred during processing request: co
      m.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page \"Test\". <a href=\"https://docs.atlassian.com/confluence/docs-86/PDF+export+in+Confluence+Data+Center\">Learn mo
      re</a>
       -- url: /confluence/spaces/flyingpdf/pdfpageexport.action | userName: admin | referer: https://linux-56273.prod.atl-cd.net/confluence/display/PD/Test | traceId: 5b093dbebd82045c
      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test". <a href="https://docs.atlassian.com/confluence/docs-86/PDF+export+in+Confluence+Data+Center">Learn more</a>
              at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:62)
              at com.atlassian.confluence.extra.flyingpdf.impl.PdfExportSemaphore.run(PdfExportSemaphore.java:28)
              at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.execute(ExportPageAsPdfAction.java:34)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)
              at ognl.OgnlRuntime.invokeMethodInsideSandbox(OgnlRuntime.java:1245)
              at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:1230)
              at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1958)
              at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
              at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:98)
              at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:90)
              at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:2034)
              at ognl.ASTMethod.getValueBody(ASTMethod.java:97)
              at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
              at ognl.SimpleNode.getValue(SimpleNode.java:258)
              at ognl.Ognl.getValue(Ognl.java:586)
              at com.opensymphony.xwork2.ognl.OgnlUtil.ognlGet(OgnlUtil.java:602)
              at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:578)
              at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:434)
              at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:307)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
              at com.atlassian.xwork.interceptors.XWorkProfilingInterceptor.intercept(XWorkProfilingInterceptor.java:16)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:256)
              at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:179)
              at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
              at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:25)
              at com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:299)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
              at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
              at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
              at com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:299)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
              at com.atlassian.confluence.security.interceptors.CaptchaInterceptor.intercept(CaptchaInterceptor.java:44)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:256)
              at com.atlassian.xwork.interceptors.XWorkProfilingInterceptor.intercept(XWorkProfilingInterceptor.java:16)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:256)
              at com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:117)
              at com.atlassian.confluence.xwork.ConfluenceXsrfTokenInterceptor.intercept(ConfluenceXsrfTokenInterceptor.java:30)
      .
      .
      .
      Caused by: com.atlassian.confluence.importexport.ImportExportException: We couldn't complete your export. There was an error converting the page "Test". <a href="https://docs.atlassian.com/confluence/docs-86/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.createPdf(SandboxPdfExporterService.java:340)
              at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForPage(SandboxPdfExporterService.java:230)
              at com.atlassian.confluence.extra.flyingpdf.impl.DelegatingPdfExporterService.createPdfForPage(DelegatingPdfExporterService.java:54)
              at com.atlassian.confluence.extra.flyingpdf.impl.BigBrotherPdfExporterService.createPdfForPage(BigBrotherPdfExporterService.java:122)
              at com.atlassian.confluence.extra.flyingpdf.impl.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:41)
              ... 459 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: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)
              ... 465 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)
              ... 470 more
      

      Workaround

      1. Install Confluence Source Code Editor
      2. Edit the page, then click the Source Editor icon to edit the page source
      3. Search for the stack of <ul><li></ui></li> tags
      4. Once identified, remove all nested <ul><li></ui></li>  tags 
      5. Save Page
      6. Generate PDF

        1. image-2023-11-05-15-23-35-302.png
          109 kB
          Shivangi Nayak
        2. image-2023-11-05-15-18-07-054.png
          121 kB
          Shivangi Nayak
        3. image-2023-11-05-15-14-31-160.png
          365 kB
          Shivangi Nayak

            Assignee:
            Saba Taseer
            Reporter:
            Shivangi Nayak
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: