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

Updating a page via REST API causes 501 error after upgrading to Confluence 7+ due to contentproperties table modification

      Atlassian Update - Feb 2020

      Hi All,

      We have prepared a fix for this issue and we have made this fix available in the Confluence EAP release 7.4.0-m05 and in Confluence 7.3.3. 

      We went through all cases reported for this issue (at least all we were able to reproduce), and fixed it by introducing a new recovery mechanism for unreconciled page updates. Recovery should happen transparently for all callers, so the API should behave as it used to before 7.0 (but now without danger of losing unpublished changes). Please give it a try and provide feedback.

      On a side note please keep in mind, that in rare cases ExternalChangesException can still happen in the case where content update fails for some reason, so please don't forget to handle it appropriately. The fix also includes changes to solve the problem with visibility of ExternalChangesException class in the plugins and changes to the confusing exception message.

      Lastly, if you need more fine access over the content reconciliation process, please consider using PageUpdateService. Its prepare() method can be used to ensure that content and draft are synchronized and are ready for updates. Methods of this service can be called within as well as outside of the active database transaction.

      Thank you for your patience and we look forward to receiving your feedback on this fix.

      Regards,

      The Confluence Team

      Issue Summary

      Updating a page via REST API causes 501 error after upgrading to Confluence 7+ the first time it's called.
      The propertyname = 'sync-rev-source' or equivalent from the table contentproperties is replaced with the value restored in all rows.
      Viewing the page or making the call again will succeed as it sets the 'propertyname' back to 'synchrony' or 'synchrony-ack' as expected.

      Steps to Reproduce

      1. Install Confluence 6.15.9 and make sure the Demonstration Space was created (You can create other pages for testing)
      2. Run the following query:
        select * from contentproperties where propertyname = 'sync-rev-source';
        1. Make sure that none of the properties is set to 'restored'. They should be either 'synchrony-ack' or 'synchrony' as described on How do drafts work.
      1. Upgrade Confluence to 7.1.0
      2. Make sure not to view any of the pages
      3. Execute the same query again. You should be able to see that every property was set to 'restored':
        +--------------+-----------------+---------------+-----------+-----------+-------------+
        | propertyid   | propertyname    | stringval     | longval   | dateval   | contentid   |
        |--------------+-----------------+---------------+-----------+-----------+-------------|
        | 131237       | sync-rev-source | restored      | <null>    | <null>    | 65590       |
        | 131328       | sync-rev-source | restored      | <null>    | <null>    | 65628       |
        | 131291       | sync-rev-source | restored      | <null>    | <null>    | 65607       |
        
      1. Pick one of the rows with 'restored' value and it's contentId and execute following REST
        PUT request: {base-url}
        /rest/api/content/
        
        {contentId} with this json body:
        {"id":{contentId}
        ,"type":"page",
        "title":"new page updated","space":
        
        {"key":"key"}
        ,"body":{"storage":{"value":
        "<p>This is the updated text for the new page updated</p>","representation":"storage"}},"version":
        
        {"number":1}
        }}
        
      1. Notice the following response:
        {
        "statusCode": 501,
        "message": "Unable to save changes to unreconciled page ContentId
        
        {id=65607}
        . Refreshing the page should fix this.",
        "reason": "Not Implemented"
        }

      Expected Results

      The page is updated accordingly.

      Actual Results

      A 501 error is received and the page is not updated.

      Workaround

      Making the call again or viewing the page will allow it to work as it sets the stringval in contentproperties back to synchrony or synchrony-ack.

      • 7.0.2 - Disabling/enabling collaborative editing clears the 'sync-rev-source' values and allows the calls to work. This method does not work for 7.1.0.

      Notes

      Known to cause issues with some plugins like K15 Scroll Versions when trying to publish pages, as the same error is thrown when using the JAVA API methods saveContentEntity() and saveNewVersion() from the com.atlassian.confluence.pages.DefaultPageManager class.
      Calling again the methods does not always work in setting the stringval in contentproperties back from "restored" as opposed to the REST API so that workaround for plugins is not reliable.

            [CONFSERVER-59196] Updating a page via REST API causes 501 error after upgrading to Confluence 7+ due to contentproperties table modification

            Eva Dezsi added a comment - - edited

            Eva Dezsi added a comment - - edited All the data is found under ticket  https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-266691

            Eva Dezsi added a comment -

            Hi Maksym Fedoryshyn, we upgraded to Confluence version 7.3, to have this fix, then we managed to migrate all Gliffy diagrams to Gliffy on Friday. Today we have the following behaviour:

            • when a page is not in Edit mode: it displays a Lucidchart diagram, and one, by clicking on the diagram is redirected to a Lucidchart diagram
            • when a page is in Edit mode, it is a Gliffy diagra, and by by clicking on the diagram, a Gliffy edit mode diagram is opened

            When we migrate the diagram again, the it is Lucidchart in the edit mode as well. But until when? When will it be changed back?

            This is a serious issue, and it is affecting our Confluence database integrity. Please advise us what we could to to fix the issue.

            Thank you.

            Eva Dezsi added a comment - Hi Maksym Fedoryshyn, we upgraded to Confluence version 7.3, to have this fix, then we managed to migrate all Gliffy diagrams to Gliffy on Friday. Today we have the following behaviour: when a page is not in Edit mode: it displays a Lucidchart diagram, and one, by clicking on the diagram is redirected to a Lucidchart diagram when a page is in Edit mode, it is a Gliffy diagra, and by by clicking on the diagram, a Gliffy edit mode diagram is opened When we migrate the diagram again, the it is Lucidchart in the edit mode as well. But until when? When will it be changed back? This is a serious issue, and it is affecting our Confluence database integrity. Please advise us what we could to to fix the issue. Thank you.

            5140883 added a comment -

            Hi eva.dezsi, we got the same issue with 6.15.8, and it seems occur regularly, almost every Friday afternoon. There is nothing to do to fix it but restart service. Need your help, thanks!

            5140883 added a comment - Hi  eva.dezsi , we got the same issue with 6.15.8, and it seems occur regularly, almost every Friday afternoon. There is nothing to do to fix it but restart service. Need your help, thanks!

            Dan Taube added a comment -

            Just wanted to share that this affects the Comala Publishing app. That allows you to publish from one space (draft) to another (target).

            It was intermittent, but the workaround was to retry 20+ times or just delete and purge the page in the target space. As we saw it more, we finally opened a ticket with Comala and within 24 hours they reviewed logs and linked it to this bug. Wanted to share so that others searching with a similar issue can find this page.

            Our route forward is to upgrade to 7.3.3. We had it in TEST and were evaluating before finding this out anyways, so it works for us.

            Dan Taube added a comment - Just wanted to share that this affects the Comala Publishing app. That allows you to publish from one space (draft) to another (target). It was intermittent, but the workaround was to retry 20+ times or just delete and purge the page in the target space. As we saw it more, we finally opened a ticket with Comala and within 24 hours they reviewed logs and linked it to this bug. Wanted to share so that others searching with a similar issue can find this page. Our route forward is to upgrade to 7.3.3. We had it in TEST and were evaluating before finding this out anyways, so it works for us.

            Eva Dezsi added a comment -

            Hi Maksym Fedoryshyn,

            We have a confluence ticket opened: CSP-266691 - there you can find all details, the log files as the steps you need to take to reproduce it.

            Related to the Confluence version, we have upgraded from 7.1 to version 7.3.3. What is really strange - after the upgrade we have run the Confluence search index after the upgrade, tried the migration, and if failed, it was the same behaviour as before the upgrade - no error, nothing happening. Now - we started the migration and it is working. What do you think changed? And most importantly, how can we ensure that the same will happen on the live instance, once we have upgraded it, and the behaviour is not as random as on the test instance.

            Thank you.

            Kind regards,

            Eva 

            Eva Dezsi added a comment - Hi Maksym Fedoryshyn, We have a confluence ticket opened: CSP-266691 - there you can find all details, the log files as the steps you need to take to reproduce it. Related to the Confluence version, we have upgraded from 7.1 to version 7.3.3. What is really strange - after the upgrade we have run the Confluence search index after the upgrade, tried the migration, and if failed, it was the same behaviour as before the upgrade - no error, nothing happening. Now - we started the migration and it is working. What do you think changed? And most importantly, how can we ensure that the same will happen on the live instance, once we have upgraded it, and the behaviour is not as random as on the test instance. Thank you. Kind regards, Eva 

            Hi eva.dezsi, thank you for letting us know that this is still an issue for you.

            Can you please provide more details on the issue with migration? This will help us to better understand the problem. Some useful items would be:

            • logs with stack traces for errors during migration
            • what confluence version is used?
            • steps to reproduce (pls. include links to all plugins involved in the migration, please also mention their versions)
            • dataset which can help to reproduce the issue (space/site exp. etc.)

            Thank you,
            -Maksym Fedoryshyn.

            Maksym Fedoryshyh added a comment - Hi eva.dezsi , thank you for letting us know that this is still an issue for you. Can you please provide more details on the issue with migration? This will help us to better understand the problem. Some useful items would be: logs with stack traces for errors during migration what confluence version is used? steps to reproduce (pls. include links to all plugins involved in the migration, please also mention their versions) dataset which can help to reproduce the issue (space/site exp. etc.) Thank you, -Maksym Fedoryshyn.

            Eva Dezsi added a comment -

            For us the fix did not solve the issue, Gliffy to Lucidchart migration is still unsuccessful.

            Eva Dezsi added a comment - For us the fix did not solve the issue, Gliffy to Lucidchart migration is still unsuccessful.

            Minh Tran added a comment -

            A fix for this issue is available to Server and Data Center customers in Confluence 7.3.3
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Minh Tran added a comment - A fix for this issue is available to Server and Data Center customers in Confluence 7.3.3 Upgrade now or check out the Release Notes to see what other issues are resolved.

            Maksym Fedoryshyn it is great you managed to fix it. Could you please share potential release date? At least rough estimate. We are desperately waiting for this fix! Thank you.

            Milan Tomasek added a comment - Maksym Fedoryshyn it is great you managed to fix it. Could you please share potential release date? At least rough estimate. We are desperately waiting for this fix! Thank you.

            Confirming on my side too, my automated page update script now works like a charm on my test server with the 7.4.0-m05 version.
            Looking forward to viewing the official release!

            Gaël NEUEZ added a comment - Confirming on my side too, my automated page update script now works like a charm on my test server with the 7.4.0-m05 version. Looking forward to viewing the official release!

              mfedoryshyn Maksym Fedoryshyh
              dmark@atlassian.com Danny (Inactive)
              Affected customers:
              142 This affects my team
              Watchers:
              114 Start watching this issue

                Created:
                Updated:
                Resolved: