Uploaded image for project: 'Confluence Server and Data Center'
  1. Confluence Server and Data Center
  2. CONFSERVER-59227

Duplicate content shown when editing a page

    XMLWordPrintable

Details

    Description

      Note

      The fix has been backported and is pending release in Confluence 7.4.14.

      The duplication of content described in this issue is unintended and is thus something we are working to fix. We have noted the cause of this issue below, and as such this fix addresses only this particular cause of duplicated content. It is also important to note that there are some circumstances where duplicate content appears due to a safety mechanism and is thus expected albeit sub-optimal behaviour.

      All of the data reports provided by commenters on this issue indicate they were seeing duplicate content with the cause detailed below. Thus we expect this fix should resolve the issue for everyone here, but want to be clear that if the duplication was caused by a different issue, it will not be resolved by this fix.

      To that end, we have recently identified a new issue that presents in a similar way. If you are still seeing duplication after upgrade to a version of Confluence that contains a fix for this issue, please see CONFSERVER-69074: Duplicate Content Shown When Editing A Page After Modifying An Attachment and CONFSERVER-73383: Duplicate Content Shown When Editing A Newly Published Page for additional details.

      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

      Attachments

        Issue Links

          Activity

            People

              mfedoryshyn Maksym Fedoryshyh
              lfaganello@atlassian.com Leonardo Faganello (Inactive)
              Votes:
              160 Vote for this issue
              Watchers:
              258 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: