Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-60219

'HTTP 504 Gateway Time-out' when storage-to-view converting pages with many static connect macros

      Rendering of pages having many static connect macros (without caching) can cause a gateway timeout if the rendering takes longer than 60 seconds.

      We ran into this when one of our customers exported a single page having a lot of multi-excerpt macros (those are static connect macros).
      Calling the /contentbody/convert/export_view REST API apparently took longer than one minute so the gateway closed the connection.

      This is a critical issue for us, because customers don't think of timeouts when adding (connect) macros on their pages.

      Steps to reproduce:

      1. Install an addon providing a 'dummy' static content macro that sleeps three seconds (contact cli@atlassian.com for this) 
      2. Insert 20 of the dummy macros into a Confluence page. Alternatively, POST the following JSON containing twenty of these macros to <your- site>/wiki/rest/api/contentbody/convert/export_view
        {
            "value" : "<p>before</p> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <ac:structured-macro ac:name=\"dummy\" ac:schema-version=\"1\" ac:macro-id=\"c9a41198-7f37-4009-842f-d263f02409d6\"/> <p>after</p>",
            "representation" : "storage"
        }
      1. You'll run into a '504 Gateway Time-out' after exactly one minute.

      Investigation Results: 

      I think the problem is that currently the Confluence page waits for all macros on the page to send back a response before rendering all of them. Because of this, when one macro times out, the entire page cannot be rendered.

      Solution:

      Refer to Steven's comment. 

            [CONFCLOUD-60219] 'HTTP 504 Gateway Time-out' when storage-to-view converting pages with many static connect macros

            No work has yet been logged on this issue.

              89741866c57b Ashish Shirode
              9a0e36f56f3a Jens Henrik Jens Henrik
              Affected customers:
              1 This affects my team
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: