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

Some users are unable to publish a page due to "ContentUpdatedEvent" Error when connected to the database via datasource configuration

XMLWordPrintable

      Note

      This issue is caused by a missing property in our previously provided configuration documents. We have updated our documentation to correct this oversight. Please review Configuring a datasource connection to ensure your configuration is up to date.

      If you would like additional details, please take a moment to review this comment.

      Issue Summary

      While Confluence is connected to the database via DataSource, we will see the following error in the atlassian-confluence.log despite the page publish successfully:

      2020-02-25 16:31:18,884 ERROR [http-nio-6731-exec-6] [atlassian.confluence.event.ConfluenceEventDispatcher] run There was an exception thrown trying to dispatch event [com.atlassian.confluence.event.events.content.page.synchrony.ContentUpdatedEvent@f2a4df3d] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.confluence.plugins.synchrony.service.SynchronyContentService.syncContentOnUpdate(com.atlassian.confluence.event.events.content.page.synchrony.ContentUpdatedEvent), listener=com.atlassian.confluence.plugins.synchrony.service.SynchronyContentService@6691a1d9} (timed)]
       -- referer: http://localhost:6731/c731/pages/resumedraft.action?draftId=327693&draftShareId=2667a813-0d56-46b0-a249-45a6ecd709b4& | url: /c731/rest/api/content/327693 | traceId: 32b4e11053495fb0 | userName: admin
      java.lang.RuntimeException: com.atlassian.sal.spi.HostConnectionAccessor returned connection with autocommit set. Listener: com.atlassian.confluence.plugins.synchrony.service.SynchronyContentService event: com.atlassian.confluence.event.events.content.page.synchrony.ContentUpdatedEvent
      	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:57)
      	at com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimedListenerInvoker.invoke(ConfluenceListenerHandlersConfiguration.java:96)
      	at com.atlassian.confluence.event.ConfluenceEventDispatcher$VCacheRequestContextRunnableFactory$1.lambda$run$0(ConfluenceEventDispatcher.java:93)
      	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
      	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
      	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
      	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)
      	at com.atlassian.confluence.event.ConfluenceEventDispatcher$VCacheRequestContextRunnableFactory$1.run(ConfluenceEventDispatcher.java:93)
      .....
      ....
      ....
      ....
      Caused by: java.lang.IllegalStateException: com.atlassian.sal.spi.HostConnectionAccessor returned connection with autocommit set
      	at com.atlassian.sal.core.rdbms.DefaultTransactionalExecutor.assertAutoCommitFalse(DefaultTransactionalExecutor.java:94)
      	at com.atlassian.sal.core.rdbms.DefaultTransactionalExecutor.executeInternal(DefaultTransactionalExecutor.java:82)
      	at com.atlassian.sal.core.rdbms.DefaultTransactionalExecutor.lambda$execute$0(DefaultTransactionalExecutor.java:43)
      	at com.atlassian.sal.spring.connection.SpringHostConnectionAccessor.lambda$execute$0(SpringHostConnectionAccessor.java:55)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      	at com.atlassian.sal.spring.connection.SpringHostConnectionAccessor.execute(SpringHostConnectionAccessor.java:49)
      

      Steps to Reproduce

      1. Install Confluence and connect any supported database via datasource
      2. Create a new page
      3. Publish the page
      4. Check the atlassian-confluence.log

      Expected Results

      The page publishes successfully with no errors in the log.

      Actual Results

      The page publishes successfully but with errors in the log.

      Notes

      If 2 users are editing the same page this error is thrown when the first user publishes (or saves) the page and later when the second user tried to publish or save he will get a pop-up with the error "Can't sync with the server. Refresh the page to try to re-establish the connection.". Refreshing the page allows to proceed.

      Workaround

      Configure the following attribute to your Tomcat datasource:

      defaultAutoCommit="false"
      

      Just as an example, here's a sample datasource configuration for PostgreSQL with this attribute:

      <Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
                            username="conf744dc"
                            password="conf744dc"
                            driverClassName="org.postgresql.Driver"
                            url="jdbc:postgresql://127.0.0.1:5432/conf744dc"
                            maxTotal="60"
                            maxIdle="20"
                            defaultAutoCommit="false"
                            validationQuery="select 1" />  
      

      Confluence needs to be restarted so the modifications in server.xml are captured.
      Also, if running on Data Center you must configure it on all nodes of the cluster.

      Check the Tomcat documentation for additional information on attributes to configure the Tomcat JDBC datasource.

        1. stacktrace.txt
          41 kB
          Jonathan Soo

              jponting James Ponting
              jwaihou Jonathan Soo
              Votes:
              45 Vote for this issue
              Watchers:
              67 Start watching this issue

                Created:
                Updated:
                Resolved: