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

Extremely slow PDF export in Confluence 5.10.x while running behind a proxy

XMLWordPrintable

      Summary

      When running Confluence 5.10.x + behind a proxy server, PDF exports are extremely slow (upwards of 4 minutes in some cases). This occurs when exporting a page of any size to PDF.

      Environment

      • Confluence running behind a reverse proxy (even with the appropriate configuration in server.xml)

      Steps to Reproduce

      1. Install Confluence 5.10.x
      2. Configure Confluence to run behind a proxy
      3. Export any page to PDF

      Expected Results

      PDF export completes quickly.

      Actual Results

      PDF export takes several minutes to complete. The below exception is thrown in the catalina.out log

      WARNING [ContainerBackgroundProcessor[StandardEngine[Standalone]]] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDe
      tected Thread "http-nio-8090-exec-7" (id=209) has been active for 63,805 milliseconds (since 10/10/16 8:48 PM) to serve the same request for http://marketing.caisgroup.com/wf/click?upn=P9Kozy4bmh4M8yjnh44OgtAhqq-2F-2F8D7n2W92yeJKt7Y-3D_JHlVOQoHtKPdkEiMbjTobJwlXz4IzRQzbYzSGvmGIbK9LpOrv017XjmgWjO2WqjSIzhXA5v46kU3XBOiFMfds2qh6fQrnj5Y9qyWHsRFzP2xWDrzesIkiXGORXeB-2BwiKTFXrfZ-2BXnvLNBRR5IaJ4CTqoSm8QWTcNR2E9L9LZnNXTdBQJV-2Bm3ymMPLPbm2WasOt74V7C6UfKpnzhT80EHh6ta26Yr0pjrjFi6zTraxFxO30-2F7R8tZj18WE8gUmKn-2F
      group.com/spaces/flyingpdf/pdfpageexport.action?pageId=5406820 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.
      

      The below exception is thrown in the atlassian-confluence.log:

      2016-10-10 20:50:11,686 WARN [http-nio-8090-exec-7] [confluence.util.profiling.DefaultActivityMonitor] close Exceeded the threshold of 60000 ms: ActivitySnapshot{startTime=1476146884364, threadId=209, threadName='http-nio-8090-exec-7', userId='xxx', type='web-request', summary='/spaces/flyingpdf/pdfpageexport.action?pageId=pageid'}
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 728a88e5d180b96b | userName: xxx | referer: https://baseURL/pages/viewpage.action?spaceKey=SPC&title=TitleofDoc
      

      Prior to this, we can see that the PDF export itself completes fairly quickly:

      2016-08-30 16:26:00,234 DEBUG [http-nio-8443-exec-19] [extra.flyingpdf.html.RenderedXhtmlBuilder] renderToHtml Rendering to exported XHTML page id=4391148 (Adjust session time-out value)
      2016-08-30 16:26:00,243 DEBUG [http-nio-8443-exec-19] [extra.flyingpdf.html.AutoFontScaleUtils] applyTableScalingLogic Total scaling time : 0
      2016-08-30 16:30:14,798 DEBUG [http-nio-8443-exec-19] [confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter] open PDF document open
      2016-08-30 16:30:14,799 DEBUG [http-nio-8443-exec-19] [confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter] setPageCount PDF document setPageCount 1
      2016-08-30 16:30:14,801 DEBUG [http-nio-8443-exec-19] [confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter] newPage PDF document newPage
      2016-08-30 16:30:14,802 DEBUG [http-nio-8443-exec-19] [confluence.extra.flyingpdf.FlyingSaucerXmlToPdfConverter] close PDF document closed
      2016-08-30 16:30:14,804 WARN [http-nio-8443-exec-19] [confluence.util.profiling.DefaultActivityMonitor] close Exceeded the threshold of 60000 ms: ActivitySnapshot{startTime=1472538360232, threadId=196, threadName='http-nio-8443-exec-19', userId='admin', type='web-request', summary='/spaces/flyingpdf/pdfpageexport.action?pageId=pageid'}
       -- url: /spaces/flyingpdf/pdfpageexport.action | traceId: 34c44df638fa91b8 | userName: xxx | referer: https://baseURL/display/SYS/doctitle

      Notes

      It appears that the PDF is actually exported to the temp directory fairly quickly and the GET request is what is taking a long time. Looking at a HAR file, pdfpageexport.action https://baseURL/spaces/flyingpdf/pdfpageexport.action?pageId=65541" is throwing a 302. The location of the request is /download/temp/pdfexport-20160831-310816-1646-18/ds-documentname-310816-1646-19.pdf?contentType=application/pdf.

      Workaround

      Add an entry in /etc/hosts that resolves the proxy server address to the localhost IP:

      127.0.0.1    proxy.url.com

      If you are using a web proxy, you will also need to update "http.nonProxyHosts" and "https.nonProxyHosts" list with the domain name of the application "proxy.url.com".

              mbereznitsky Mark Bereznitsky
              jbennett@atlassian.com J van Leeuwen
              Votes:
              15 Vote for this issue
              Watchers:
              35 Start watching this issue

                Created:
                Updated:
                Resolved: