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

Custom Javascript includes cause pages to load slowly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Medium
    • None
    • 5.8.13
    • None
    • Standalone as well as Confluence Datacenter

    Description

      Pages with Custom Javascript stored in an HTML macro from the /Confluence-Install/confluence/includes/js directory are now taking over twenty (20) seconds to load when refreshing or loading a page. Javascript URL renders immediately, but some background process is occurring that is causing pages to wait for twenty (20) seconds before loading completely.

      Shown in the screenshots from Firefox and Canary below:


      Firefox Firebug NetExport Capture


      Chrome Developer Tools Capture

      I am attaching HAR Files from these tests to the case herein as well as canary.har and firefox.har both of which show the 20+ seconds delay just on page load and refresh. This is only referring to page load and does not include the page editing as they have implemented a workaround previously provided for that issue.

      Steps to Reproduce the Issue

      1. Create a custom.js file - in this case I used both the client's custom javascript file and a simple sample.js file to test the issue. Both test cases produce the same resulting slowness
      2. Place the custom.js file in the /Confluence-Install/confluence/includes/js directory and insure that the permissions and ownership are the same as the rest of the files in the directory
      3. Whitelist the localhost URL and context path in the Confluence Admin interface (was checking this as a possible avenue for the slowness - did not help or harm the issue)
      4. In a Space, create a Page to test the Javascript Include function
      5. Create an HTML macro on that page
      6. insert the following code within the macro:
         <script type="text/javascript" src="/CONTEXT_PATH/includes/js/custom.js"></script> 

        NOTE: the CONTEXT_PATH should match the context for the instance and the custom.js file should match the name of your custom.js file as it exists in the instance as well, or this will not work

      7. Save the page
      8. Refresh the page and observe the twenty second (20 sec.) load time induced when the call is made
      9. Initial reports in Firebug and Developer Tools do not show the delay until the Javascript is loaded.
      10. Go to the URL path http://localhost/context/includes/js/custom.js and take note that the page loads the javascript immediately, however, the spinner in the browser does not stop loading for a bit longer even though the javascript has rendered in the browser. Not sure why that is occurring, but this too loads slowly at 20+ seconds, even though the script renders immediately
        in the browser, the actual delay still persists in a direct render. This is captured in the file firefoxdirect.har which is attached as well.

      What is known

      This problem did not occur in Confluence Standalone or Datacenter 5.7.5, but does occur in Confluence Standalone and Datacenter 5.8.13 and 5.8.14. Something has changed in between the two branches that is causing slow-loading of the includes in Confluence. Not sure what might be causing this, so hopefully the HAR files and browser tests will provide some insight. I am also including the MP4 files that kyong created and attached to CONF-39799 which show the reproduction of the issue in Confluence 5.8.14 and the non-reproduction in Confluence 5.7.5 as well for your review herein.

      Workaround

      The only known workaround here is to disable the

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ctalk chucktalk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: