Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-53535

Create page using REST API fails when page containts tasks with @mention

    XMLWordPrintable

Details

    Description

      We are working on an experiment where the first user / evaluator creates two spaces and a bunch of content using the Confluence rest api. In a few pages we have tasks with the user @mentioned. These seem to quite often cause our create page to fail with a transaction rollback, and thus causing our experiment to fail.

      Here's a few log snippets and analysis:

      @4000000054feead01f05278c 2015-03-10 12:59:50,492 ERROR [TP-Processor3] [atlassian.event.internal.AsynchronousAbleEventDispatcher] run There was an exception thrown trying to dispatch event [ConfluenceTaskCreateEvent

      Unknown macro: {user=com.atlassian.confluence.user.ConfluenceUserImpl@203f4f[vcosta46,ff8080814c03b7ff014c03b80f960001], task=Task [globalId=0, id=1, contentId=491540, taskStatus=UNCHECKED, title=Vitor Costa [Administrator] https}

      ] from the invoker [SingleParameterMethodListenerInvoker

      Unknown macro: {method=public void com.atlassian.mywork.providers.confluence.ConfluenceTasksEventListener.onTaskCreatedEvent(com.atlassian.confluence.plugins.tasklist.event.ConfluenceTaskCreateEvent) throws java.lang.Exception, listener=com.atlassian.mywork.providers.confluence.ConfluenceTasksEventListener@82bae0}

      ]
      @4000000054feead01f056ddc – referer: https://carglasspt.atlassian.net/wiki/dashboard.action | url: /wiki/rest/api/content | userName: vcosta46
      @4000000054feead01f0571c4 java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException
      @4000000054feead01f0571c4 at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:50)
      @4000000054feead01f0575ac at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
      @4000000054feead01f057994 at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
      @4000000054feead01f057d7c at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
      ...
      @4000000054feead01f0a53c4 at com.sun.proxy.$Proxy2590.createOrUpdate(Unknown Source)
      *@4000000054feead01f0a53c4 at com.atlassian.mywork.providers.confluence.ConfluenceTasksEventListener.onTaskCreatedEvent(ConfluenceTasksEventListener.java:65)*
      @4000000054feead01f0a5b94 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      ...
      @4000000054feead01f0c14fc Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "u_ao_9412a1_aouser_username"
      @4000000054feead01f0c18e4 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077)
      @4000000054feead01f0c18e4 at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810)
      @4000000054feead01f0c20b4 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      @4000000054feead01f0c20b4 at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498)
      @4

      that causes transaction to rollback

      @4000000054feead022dac484 2015-03-10 12:59:50,575 ERROR [TP-Processor3] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error :
      @4000000054feead022dacc54 – referer: https://carglasspt.atlassian.net/wiki/dashboard.action | url: /wiki/rest/api/content | userName: vcosta46
      @4000000054feead022dad03c org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
      @4000000054feead022dad03c at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:695)
      @4000000054feead022dae7ac at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
      @4000000054feead022daeb94 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      @4

      From

      com.atlassian.mywork.host.dao.ao.AOUserDao.getAO(AOUserDao.java:40)
      

      it looks like the issue is that find AOUser below returns null:

          private AOUser getAO(UserKey userKey)
          {
              AOUser user =  findOnly(select().where("USERNAME = ?", userKey.getStringValue()));
              if (user == null)
              {
                  user = ao.create(AOUser.class, new DBParam("USERNAME", userKey.getStringValue()));
                  user.setCreated(new Date());
                  user.setUpdated(user.getCreated());
              }
              else
              {
                  user.setUpdated(new Date());
              }
              return user;
          }
      

      So concurrency / transaction stuff.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sjaatinen Sami Jaatinen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: