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

Attachments become 'Unknown Attachment' in the page editor with Collaborative Editing turned on

      Atlassian Update - 19 May 2021

      PLEASE NOTE: This fix will stop new occurrences of the bug. It does not correct pages already affected by the bug. We have released a plugin to begin correcting pages that already affected, you can obtain more details about it on the related issue CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format


      Previously we released what we believed was a fix in Confluence 7.4.6 and 7.8.0, and closed this ticket. Unfortunately this fix was only partial, so customers running these and subsequent versions have a partial fix in place. It turns out this issue was more complex than we had previously understood and we apologise to anyone inconvenienced by the bug or the partial fix.

      Whilst this ticket addresses the bug itself and should stop future occurrences, we understand a significant number of our customers are already impacted with some impacted across a large number of pages and drafts. With this in mind, we've created CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format to track our work on creating a method to fix the issue for customers already impacted. This ticket is currently in progress.

      To be clear, whilst the goal is to have some method that automatically corrects the issue for impacted customers, there may be some cases wherein automatic correction is not possible and manual intervention may be required. Hopefully we can find a one click solution, but I want to set expectations early and clearly that it may not be possible.

      We appreciate your continued patience as we continue working to finalise this issue.

      Thanks,
      James Ponting
      Premier Support Engineer

      Summary

      When the storage format of a page embeds an image that is not yet attached to the page, the image will still be rendered as "Unknown attachment" in the page editor although the image has been added to the page beforehand.

      Steps to replicate

      1. Ensure Collaborative Editing is switched on.
      2. Create a page with this storage format.
        <p><ac:image ac:height="250"><ri:attachment ri:filename="test.jpg"/></ac:image></p>
        
      1. The page displays "Unknown attachment".
      2. Via '...' > 'Attachments', just insert an attachment 'test.jpg' into the page. You'll see that the page now contains 1 attachment, which is 'test.jpg'.
      3. View the page you first created and the image is now there.
      4. Edit the page.

      Expected results

      The image would still be displayed.

      Actual results

      The image is now replaced by the initial "Unknown attachment" message.

      Notes

      If a script that uses REST API to automate the process of creating/copying pages and uploading attachments to it is being used, please remember to follow the order below in the creation of the page to avoid being affected by this bug:

      1. create a page in Confluence
      2. add the attachments to this created page
      3. update the page with the expected content, in the storage format, using REST API

      Workaround

      Option 1 (preferred) - If the storage format is not yet broken with unknown placeholder.

      Leave an inline comment on any text of the page. You can delete or resolve it immediately afterwards. Attachment upload doesn't change page storage format, so the code path that triggers sending view page updates to synchrony is not used. Leaving an inline comment triggers the path, pushing updated editor format data into synchrony.
       

      Option 2 - For Confluence 6.9 and up
      1. Open the editor for the affected page
      2. Click on the ellipsis button on the bottom right corner of the screen (besides the Close button)
      3. Click on revert back to the last published version
      4. Check if the attachment appears on the editor now

      The problem is caused by the draft entry on the DB being created before the attachment exists. The application replaces the attachment name with plugins/servlet/confluence/placeholder/unknown-attachment?locale=en_US&version=2 in that situation. Following the steps from Option 2 creates a new draft entry for this page, so it is able to recognize the attachment.

      Additional Issues

      Update of Unknown Attachments on versions greater than 7.7.3

      Confluence can generate an attachment XML with <ri:content-entity content-id="..."> that renders as an unknown attachment. When it happens, it affects the whole page and will likely impact multiple pages. An examlpe of the issue is shown below

      <p>
        <ac:image>
          <ri:attachment ri:filename="image2020-10-21_12-40-38.png">
            <ri:content-entity ri:content-id="138910055"/>
          </ri:attachment>
        </ac:image>
      </p>
      

      You can check which issue you may be facing by reviewing the Storage Format of the impacted page for something similar to the XML above with the content-entity tag.

      We're currently tracking this issue at CONFSERVER-60526: Confluence generates attachment xml with <ri:content-entity content-id="..."> that renders as an unknown attachment.

          Form Name

            [CONFSERVER-55928] Attachments become 'Unknown Attachment' in the page editor with Collaborative Editing turned on

            Hi All,

            Just a quick update on the work on CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format

            We're pushing an update to the Reconcile Unknown Attachments plugin today that adds functionality to add a label to a page when an Unknown Attachment is found and can't be auto repaired.

            Using this label, Confluence administrators and users can search by label to find impacted pages that need manual intervention to correct. Once corrected, simply remove the label to complete the repair.

            The app is pre-installed in Confluence 7.13.0, and can be updated in the Manage Apps panel on the Confluence Administration page. To install it for the first time, you can search for Reconcile Unknown Attachments in the Find New Apps panel.

            Thanks,
            James Ponting
            Premier Support Engineer

            James Ponting added a comment - Hi All, Just a quick update on the work on CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format We're pushing an update to the Reconcile Unknown Attachments plugin today that adds functionality to add a label to a page when an Unknown Attachment is found and can't be auto repaired. Using this label, Confluence administrators and users can search by label to find impacted pages that need manual intervention to correct. Once corrected, simply remove the label to complete the repair. The app is pre-installed in Confluence 7.13.0, and can be updated in the Manage Apps panel on the Confluence Administration page. To install it for the first time, you can search for Reconcile Unknown Attachments in the Find New Apps panel. Thanks, James Ponting Premier Support Engineer

            Hi All,

            Just a heads up that Confluence 7.13.0 has released today with the fix for this issue included.

            Thanks all for your patience and understanding as we worked through this issue.

            Regards,
            James Ponting
            Premier Support Engineer

            James Ponting added a comment - Hi All, Just a heads up that Confluence 7.13.0 has released today with the fix for this issue included. Thanks all for your patience and understanding as we worked through this issue. Regards, James Ponting Premier Support Engineer

            Hi All,

            I just wanted to let you know we've released the beta for Confluence 7.13.0: Announcing Confluence 7.13 as the Next LTS Release - Atlassian Community.

            If you would like to get a head start on your testing, this would be a good place to start.

            5717f2a94c18 - This bug explicitly tracks the versions that have a fix for the issue, the app is intended to repair pages that are already impacted by the issue. We will be shipping the app as part of Confluence as well to minimise the impact on users as best we can.

            Thanks,
            James Ponting
            Premier Support Engineer

            James Ponting added a comment - Hi All, I just wanted to let you know we've released the beta for Confluence 7.13.0: Announcing Confluence 7.13 as the Next LTS Release - Atlassian Community . If you would like to get a head start on your testing, this would be a good place to start. 5717f2a94c18 - This bug explicitly tracks the versions that have a fix for the issue, the app is intended to repair pages that are already impacted by the issue. We will be shipping the app as part of Confluence as well to minimise the impact on users as best we can. Thanks, James Ponting Premier Support Engineer

            Tobias added a comment -

            Hello together, 

            the app also works for our environment. We use Confluence Server Version 7.4.9. Thanks for providing this app to us, it is really helpful.

            But just allow me to aks one question: Will this bug be fixed in an upcoming release or don't you focus on this because your customers have to use the app permanently? 

            Thanks for your help.

            Regards,
            Tobias

            Tobias added a comment - Hello together,  the app also works for our environment. We use Confluence Server Version 7.4.9. Thanks for providing this app to us, it is really helpful. But just allow me to aks one question: Will this bug be fixed in an upcoming release or don't you focus on this because your customers have to use the app permanently?  Thanks for your help. Regards, Tobias

            Hi James,

            thank you for the detailed answer and the query. As it gives no results, we will not need to install the Unknown Attachment App. So we have to wait until the other bug is fixed in the current LTS-version.

            Regards,
            Michael

            Michael Rosenberger added a comment - Hi James, thank you for the detailed answer and the query. As it gives no results, we will not need to install the Unknown Attachment App. So we have to wait until the other bug is fixed in the current LTS-version. Regards, Michael

            Hey All,

            I just so happen to have the answer to a question here, so I'll provide it here in the hope it helps others.

            29e0d95bce1d - To your questions

            1. The plugin won't run SQL to find affected pages as it would require a very expensive regex query that would check every single page in the instance. To avoid this, we've taken an "on-demand" approach which will check pages when they're edited and the placeholder is created. If you would like to check for pages that are impacted, you can try the following query in Postgres (edit <CONFLUENCE_URL> to your Confluence site's URL). I would recommend running this query in a staging environment first to understand how long the query may take and its resource impact. I would strongly recommend running this during a quiet period if it is subsequently run on production. As below
              Identify Unknown Attachment Pages - Postgres Query
              SELECT c.contentid,
                     c.contenttype,
                     c.title,
                     s.spacekey,
                     CONCAT('<CONFLUENCE_URL>/pages/viewpage.action?pageId=', c.contentid) AS URL
              FROM CONTENT c
              JOIN BODYCONTENT bc ON c.contentid = bc.contentid
              JOIN SPACES s ON c.spaceid = s.spaceid
              WHERE c.prevver IS NULL
                  AND c.contenttype IN ('PAGE',
                                        'BLOGPOST')
                  AND bc.body LIKE '%/placeholder/unknown-attachment?%';
              

              This will give you a list of pages including links to the pages that you can follow.

            2. Unfortunately I don't believe so. From reviewing the developer notes on the issue, I understand that will be addressed by code in Confluence 7.13.0 when it releases

            I hope this helps

            Thanks,
            James Ponting
            Premier Support Engineer

            James Ponting added a comment - Hey All, I just so happen to have the answer to a question here, so I'll provide it here in the hope it helps others. 29e0d95bce1d - To your questions The plugin won't run SQL to find affected pages as it would require a very expensive regex query that would check every single page in the instance. To avoid this, we've taken an "on-demand" approach which will check pages when they're edited and the placeholder is created. If you would like to check for pages that are impacted, you can try the following query in Postgres (edit <CONFLUENCE_URL> to your Confluence site's URL). I would recommend running this query in a staging environment first to understand how long the query may take and its resource impact. I would strongly recommend running this during a quiet period if it is subsequently run on production. As below Identify Unknown Attachment Pages - Postgres Query SELECT c .contentid, c .contenttype, c .title, s.spacekey, CONCAT( '<CONFLUENCE_URL>/pages/viewpage. action ?pageId=' , c .contentid) AS URL FROM CONTENT c JOIN BODYCONTENT bc ON c .contentid = bc.contentid JOIN SPACES s ON c .spaceid = s.spaceid WHERE c .prevver IS NULL AND c .contenttype IN ( 'PAGE' , 'BLOGPOST' ) AND bc.body LIKE '%/placeholder/ unknown -attachment?%' ; This will give you a list of pages including links to the pages that you can follow. Unfortunately I don't believe so. From reviewing the developer notes on the issue, I understand that will be addressed by code in Confluence 7.13.0 when it releases I hope this helps Thanks, James Ponting Premier Support Engineer

            Hi James,

            Thanks for the detailed explanation. This is very enlightening.

            Cheers,
            Daniel

            Daniel Holz added a comment - Hi James, Thanks for the detailed explanation. This is very enlightening. Cheers, Daniel

            Hi,

            tanks for the Update and the addon. Is there a SQL-Query to get the pages that the addon will try to repair? We are currently on 7.4.9 and according to the support, we are primary affected by this bug: https://jira.atlassian.com/browse/CONFSERVER-60526 

            So I have to questions: 
            1. Is there a sql-query, that can show us the affected pages the addon will touch?
            2. Does the addon also repair the pages affected by the bug liked above?

            Regards,
            Michael

            Michael Rosenberger added a comment - Hi, tanks for the Update and the addon. Is there a SQL-Query to get the pages that the addon will try to repair? We are currently on 7.4.9 and according to the support, we are primary affected by this bug: https://jira.atlassian.com/browse/CONFSERVER-60526   So I have to questions:  1. Is there a sql-query, that can show us the affected pages the addon will touch? 2. Does the addon also repair the pages affected by the bug liked above? Regards, Michael

            Hi All,

            I just want to provide an update on our work to provide a fix for existing broken pages, and address the comments above.

            Unknown Attachment App

            Firstly, we are tracking our work to resolve the issue for pages that are already broken at CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format. We have just provided an update on that issue detailing an app that is available to resolve some of the broken attachments. I'd encourage you to carefully review the documentation for the app prior to installing it.

            If you'd prefer to go straight to the documentation (which includes a link to the app), you can head directly to Unknown attachment error in Confluence Server and Data Center 7.12 and earlier

            Understanding the Fix

            With regards to the conversation about the efficacy of this fix above involving saikrishna.patel, dbd206fd02ab, and ggautam I would like to explain some things to help understand the fix.

            Confluence uses a system called Synchrony to allow collaborative editing of pages by multiple users. When a user edits a page, Confluence (creates if necessary, then) passes a draft to Synchrony which handles the editing of the page. Changes made in Synchrony are sent back to Confluence on a timer (to make sure we don't lose data), and when the editor is closed or the page is published. The issue being tracked here occurs when Confluence passing data back and forwards with Synchrony. This fix stops newly created drafts from being impacted by this issue.

            The problem then is that there can be drafts that were created prior to this implementation of this fix that are still impacted. This would give the appearance of the bug appearing for the first time, but in reality the bug has already impacted the page, it's just not visible yet. This is, unfortunately, expected behaviour with this fix, but it is something we can help repair. In cases where this issue is becoming visible for the first time, the app mentioned above will help you resolve this issue.

            Given the impact this bug was having on our customers, we split the work of fixing the bug, and repairing impacted pages into two streams to try and get a fix out as soon as possible. This is why the solution to repair impacted pages is not part of this fix and not built into Confluence (yet).

            At this time, we understand that the issue is fixed. Our testing has reflected this, and we've been receiving confirmation from impacted customers that they're no longer seeing new occurrences of this issue.

            If you are continuing to see a related problem, please open a ticket with support at https://support.atlassian.com and we'll help you look into the issue.

            Other Question

            To address the other query I can see
            58846cf653c8 - There is no fix available for Confluence 7.9.x, however the app that attempts to repair impacted pages can be installed to mitigate the issue (it will try and repair the pages as they break). Even with this app, I would recommend upgrade to Confluence 7.12.2 (the fix is in 7.12.1) to receive the fix.

            Final Notes

            The development team and I want to extend our thanks for all the data and troubleshooting information that was provided by various people on this ticket and in related support tickets.

            Thank you also for your patience and understanding as we worked through this one. We know these issues have a massive impact on you and your users, and we've been working hard on these issues to get them fixed.

            Happy editing

            Regards,
            James Ponting
            Premier Support Engineer

            James Ponting added a comment - Hi All, I just want to provide an update on our work to provide a fix for existing broken pages, and address the comments above. Unknown Attachment App Firstly, we are tracking our work to resolve the issue for pages that are already broken at CONFSERVER-63615: Provide workaround for fixing broken unknown attachment placeholder in storage format . We have just provided an update on that issue detailing an app that is available to resolve some of the broken attachments. I'd encourage you to carefully review the documentation for the app prior to installing it. If you'd prefer to go straight to the documentation (which includes a link to the app), you can head directly to Unknown attachment error in Confluence Server and Data Center 7.12 and earlier Understanding the Fix With regards to the conversation about the efficacy of this fix above involving saikrishna.patel , dbd206fd02ab , and ggautam I would like to explain some things to help understand the fix. Confluence uses a system called Synchrony to allow collaborative editing of pages by multiple users. When a user edits a page, Confluence (creates if necessary, then) passes a draft to Synchrony which handles the editing of the page. Changes made in Synchrony are sent back to Confluence on a timer (to make sure we don't lose data), and when the editor is closed or the page is published. The issue being tracked here occurs when Confluence passing data back and forwards with Synchrony. This fix stops newly created drafts from being impacted by this issue. The problem then is that there can be drafts that were created prior to this implementation of this fix that are still impacted. This would give the appearance of the bug appearing for the first time, but in reality the bug has already impacted the page, it's just not visible yet. This is, unfortunately, expected behaviour with this fix, but it is something we can help repair. In cases where this issue is becoming visible for the first time, the app mentioned above will help you resolve this issue. Given the impact this bug was having on our customers, we split the work of fixing the bug, and repairing impacted pages into two streams to try and get a fix out as soon as possible. This is why the solution to repair impacted pages is not part of this fix and not built into Confluence (yet). At this time, we understand that the issue is fixed. Our testing has reflected this, and we've been receiving confirmation from impacted customers that they're no longer seeing new occurrences of this issue. If you are continuing to see a related problem, please open a ticket with support at https://support.atlassian.com and we'll help you look into the issue. Other Question To address the other query I can see 58846cf653c8 - There is no fix available for Confluence 7.9.x, however the app that attempts to repair impacted pages can be installed to mitigate the issue (it will try and repair the pages as they break). Even with this app, I would recommend upgrade to Confluence 7.12.2 (the fix is in 7.12.1) to receive the fix. Final Notes The development team and I want to extend our thanks for all the data and troubleshooting information that was provided by various people on this ticket and in related support tickets. Thank you also for your patience and understanding as we worked through this one. We know these issues have a massive impact on you and your users, and we've been working hard on these issues to get them fixed. Happy editing Regards, James Ponting Premier Support Engineer

            Ganesh Gautam added a comment - - edited

            Hi saikrishna.patel

            > we have tested a page which does not have any broken links or attachments, when we tried to edit the page in Confluence 7.4.9 we saw again "Unknown attachments" error like we used to see previously.

            GG - I remember the pages you shown earlier and would like to explain why. Its because of already broken draft and not a new breakage.
            Unfortunately when an attachment event was not sent to Synchrony, drafts first get broken as they are auto-saved. You can see broken attachment on the pages where drafts are already broken. I would recommend you to try the replication steps I mentioned in above comment to be sure that the pages are not broken anymore.

            Please watch CONFSERVER-63615 for the workaround issue to fix broken content.

            Thanks, 
            Ganesh

            Ganesh Gautam added a comment - - edited Hi saikrishna.patel > we have tested a page which does not have any broken links or attachments, when we tried to edit the page in Confluence 7.4.9 we saw again "Unknown attachments" error like we used to see previously. GG - I remember the pages you shown earlier and would like to explain why. Its because of already broken draft and not a new breakage. Unfortunately when an attachment event was not sent to Synchrony, drafts first get broken as they are auto-saved. You can see broken attachment on the pages where drafts are already broken. I would recommend you to try the replication steps I mentioned in above comment to be sure that the pages are not broken anymore. Please watch CONFSERVER-63615  for the workaround issue to fix broken content. Thanks,  Ganesh

              ggautam Ganesh Gautam
              azolkefli Athirah Zolkefli
              Affected customers:
              376 This affects my team
              Watchers:
              421 Start watching this issue

                Created:
                Updated:
                Resolved: