Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-52727

PDF Export Hangs When Exporting Page With JIRA Issues Macro and Nested Macros

    XMLWordPrintable

Details

    Description

      Summary

      PDF Export hangs/takes too long to export pages with JIRA Issues Macro. The more JIRA Issues Macro inside the page, the longer it takes for the export to finish.

      If the page uses nested macros with Excerpt-Include macro to include another page that has more nested macros + the JIRA Issues Macro, the export hangs even longer.

      Also, it seems that the PDF export iterates over all the issues, not only the number of displayed issues set in the JIRA Issues Macro. This means that instead of requesting 60 issues from JIRA to receive the images - type and priority (e.g. 3 JIRA Issues Macro showing 20 issues each), it iterates over hundreds/thousands of issues depending on the filter, even though it's only going to export the display limit of each macro.

      Steps to Reproduce

      1. Have a JIRA with a lot of created issues for testing.
      2. Create the application links between Confluence and JIRA.
      3. Create a page, add the Excerpt Macro and 6 JIRA Issues Macros filtering type = story inside it, for example.
      4. Create another page, add the Panel Macro > add the Tip/Expand or any other similar macro inside the Panel > add the Excerpt Include macro to include the page crated on step 3.
      5. Attempt to export the page from step 4 to PDF.

      Expected Results

      The PDF File will be generated within seconds.

      Actual Results

      The thread hangs or takes too long to finish. The below WARN is thrown in the atlassian-confluence.log file over and over due to this bug:

      2017-06-29 15:40:42,874 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,875 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,876 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,877 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,878 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,879 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,880 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,881 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,882 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,883 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      2017-06-29 15:40:42,884 WARN [http-nio-8585-exec-7] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource http://quicksilver/jira/images/icons/issuetypes/story.svg during Confluence export
       -- referer: http://quicksilver:8585/display/PB/Export+page | url: /spaces/flyingpdf/pdfpageexport.action | userName: admin | action: pdfpageexport | page: 557065
      

      Notes

      • It seems that the export takes even longer in these scenarios:
        • When we try to export a page using Excerpt Include to include another page that uses JIRA Issues macro.
        • When there's a nested usage of macros before the Excerpt Include macro. e.g. Panel > Tip > Excerpt Include
      • The logs above are flooding the log file and using a lot of resources.
      • It does not happen when exporting to Word.
      • Reviewing thread dumps or the warnings from thread stuck valve, you should see the following stack:
        16-Jun-2017 21:59:08.793 WARNING [ContainerBackgroundProcessor[StandardEngine[Standalone]]] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread "http-nio-8090-exec-81" (id=300) has been active for 60,276 milliseconds (since 6/16/17 9:58 PM) to serve the same request for https://dstreet.datalogix.com/spaces/flyingpdf/pdfpageexport.action?pageId=98379094 and may be stuck (configured threshold for this StuckThreadDetectionValve is 60 seconds). There is/are 1 thread(s) in total that are monitored by this Valve and may be stuck.
         java.lang.Throwable
        	at java.net.PlainSocketImpl.socketConnect(Native Method)
        	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        	at java.net.Socket.connect(Socket.java:589)
        	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        	at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
        	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
        	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
        	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
        	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
        	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
        	at java.net.URL.openStream(URL.java:1045)
        	at org.xhtmlrenderer.swing.NaiveUserAgent.resolveAndOpenStream(NaiveUserAgent.java:122)
        	at com.atlassian.confluence.extra.flyingpdf.ConfluenceExportUserAgent.resolveAndOpenStream(ConfluenceExportUserAgent.java:126)
        	at com.atlassian.confluence.extra.flyingpdf.ConfluenceExportUserAgent$1.get(ConfluenceExportUserAgent.java:56)
        	at com.atlassian.confluence.extra.flyingpdf.ConfluenceExportUserAgent$1.get(ConfluenceExportUserAgent.java:53)
        	at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.updateMeasurements(LightITextFSImage.java:38)
        	at com.atlassian.confluence.extra.flyingpdf.LightITextFSImage.<init>(LightITextFSImage.java:34)
        	at com.atlassian.confluence.extra.flyingpdf.ConfluenceExportUserAgent.getImageResource(ConfluenceExportUserAgent.java:58)
        	at org.xhtmlrenderer.pdf.ITextReplacedElementFactory.createReplacedElement(ITextReplacedElementFactory.java:57)
        	at org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:688)
        	at org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:642)
        	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:780)
        	at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:749)
        	at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:293)
        	at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:271)
        	at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:89)
        

      Workaround

      1. If you don't need to show the results of the JIRA Issues Macro in the PDF Export:
        1. Go to Confluence Administration > PDF Stylesheet
        2. Add these two lines there:
          div[id^="jira-issues-"] { display: none; }
          div[class^="refresh-issues-bottom"] { display: none; }
          
      2. We can remove all icons (issue types and priority) in order to avoid these calls to JIRA:
        1. Go to Confluence Administration > PDF Stylesheet
        2. Add it there:
          img.icon {  display: none !important; }
          
      3. If you still need to have the JIRA Issues Macro results in the PDF exports, we can only improve the performance a little bit:
        1. It helps a bit if we remove the Issue Type column from the JIRA Issues Macros.
        2. It also helps a bit if we set the class com.atlassian.confluence.extra.flyingpdf.ConfluenceExportUserAgent to ERROR level instead the default. See this to understand how to set it.
        3. To completely avoid the performance issues that the PDF exports may cause, we can disable the plugin Confluence PDF Export which handles the task
      4. Export to Word instead
      5. Disable the excerpt and excerpt-include modules of the Advanced Macros plugin (Manage Add-ons > Select All add-ons on the dropdown menu > search for Advanced Macros > Expand its modules > disabled the ones mentioned above).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              emallmann Eduardo Mallmann (Inactive)
              Votes:
              28 Vote for this issue
              Watchers:
              29 Start watching this issue

              Dates

                Created:
                Updated: