Note

      The fix has been backported

      For more information about this and related content duplication issues, please see the discussion at Confluence Server and Data Center: Content duplication fix and next steps - Atlassian Community.

      Issue Summary

      When editing a page, the page content, or a subset of the page content is duplicated. This behaviour occurs intermittently without any special actions by the user.

      Steps to Reproduce

      This behaviour is not consistently reproducible, but may occur when a page is edited.

      Expected Results

      The editor should display only the page content.

      Actual Results

      The content appears to be duplicated in edit mode, and publishing the page results in the duplicated content being visible in view mode.

      Root Cause

      tl;dr - Confluence and Synchrony metadata intermittently falls out of sync triggering a chain of events that result in content duplication.

      When a user clicks the edit button, Synchrony will reconcile (merge) the page content held by Synchrony, with the draft content held in Confluence. This reconciled content is then sent to the web browser to be displayed in the editor, along with draft and synchrony metadata. When the editor loads, it synchronizes the new content back to Synchrony in a process called a client reconciliation to ensure everything is in sync.

      The content duplication occurs during this client reconciliation phase. From the reports provided by customers and our internal reproduction work, we identified that the Synchrony metadata being provided contained a null value in place of the expected revision data. When Synchrony performed the client reconciliation, it performed the operation with an empty source document, thus all the content in the draft from the browser appeared new. Synchrony takes this "new" content, and adds it to the existing Confluence draft. This data is then sent back to the browser, where the user will see this duplicated content.

      On the surface this may seem a nonsensical approach, but in the context of Synchrony, this approach works perfectly so long as the correct Synchrony metadata is provided. This explains how the content duplication occurs, but the root cause is earlier in the process when the page was last saved from Synchrony into the Confluence database.

      Confluence takes advantage of an event system in the Hibernate Object Relation Manager. When a page is saved from Synchrony to Confluence, an event fires that synchronizes the metadata for Confluence and Synchrony, then cleans up stale Synchrony metadata. We identified that this event was intermittently and silently failing, resulting in the old metadata being left in Confluence, and then the matching metadata in Synchrony being deleted. Thus the when Synchrony performs the first reconciliation above, it does so with metadata from Confluence that doesn't exist in Synchrony, resulting in a null version being returned, and subsequently being served to the browser.

      This issue was often automatically corrected by Confluence depending on a host of conditions that are outside of the scope of this explanation. This further obscured the root cause of the issue as it added a level of randomness to an already intermittent issue.

      Workaround

      1. In the Editor, click the Ellipsis (...) symbol
      2. Click Revert to last published version

          Form Name

            [CONFSERVER-59227] Duplicate content shown when editing a page

            Ojas Potdar made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 961131 ]
            Edward made changes -
            Link New: This issue is related to CONFSERVER-64758 [ CONFSERVER-64758 ]
            Quan Pham made changes -
            Remote Link Original: This issue links to "Page (Extranet)" [ 526215 ]
            Cathy S made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 892609 ]
            Shakti made changes -
            Remote Link Original: This issue links to "Page (Confluence)" [ 627742 ]
            Shakti made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 823493 ]
            Mario B made changes -
            Comment [ Happens on 7.19.4 as well

              ]
            Maksym Fedoryshyh made changes -
            Remote Link New: This issue links to "Page (Extranet)" [ 695600 ]
            Maksym Fedoryshyh made changes -
            Remote Link New: This issue links to "Page (Extranet)" [ 695508 ]
            Maksym Fedoryshyh made changes -
            Remote Link New: This issue links to "Page (Extranet)" [ 695397 ]

              mfedoryshyn Maksym Fedoryshyh
              lfaganello@atlassian.com Leonardo Faganello (Inactive)
              Affected customers:
              161 This affects my team
              Watchers:
              312 Start watching this issue

                Created:
                Updated:
                Resolved: