Uploaded image for project: 'SR for Confluence - Development'
  1. SR for Confluence - Development
  2. SRCONF-437

Prune old versions terminates if a new version is created while the script is running

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: 5.4.15
    • Fix Version/s: 5.5.6
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Bug fixing 3, Sprint 100, Sprint 101, Sprint 105, Sprint 106, American Sprint 107, SR Squad 109, SR Squad 110, SR Squad 111, SR Squad 112
    • Story Points:
      3
    • Critical Points:
      0.7

      Description

      Trying to prune versions on page that is updated whilst the prune is running (intermittent).

      When a new version gets created by the bot the pruning job terminates with this error:

      Object of class [java.lang.Object] with identifier [null]: optimistic locking failed; nested exception is net.sf.hibernate.StaleObjectStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

      Steps to Reproduce

      I am currently unable to reproduce the error.

      Logs

      org.springframework.orm.hibernate.HibernateOptimisticLockingFailureException: Object of class [java.lang.Object] with identifier [null]: optimistic locking failed; nested exception is net.sf.hibernate.StaleObjectStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:593)
       at org.springframework.orm.hibernate.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:607)
       at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:518)
       at com.atlassian.confluence.impl.hibernate.ConfluenceHibernateTransactionManager.doCommit(ConfluenceHibernateTransactionManager.java:69)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
       at com.sun.proxy.$Proxy53.commit(Unknown Source)
       at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485) 
       at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) 
       at com.sun.proxy.$Proxy2544.execute(Unknown Source) 
       at com.atlassian.confluence.core.service.ServiceCommand$execute.call(Unknown Source) 
       at com.onresolve.scriptrunner.canned.confluence.jobs.PruneOldPageVersions$_doScript_closure3$_closure4$_closure6.doCall(PruneOldPageVersions.groovy:133) 
       at com.onresolve.scriptrunner.canned.confluence.jobs.PruneOldPageVersions$_doScript_closure3$_closure4.doCall(PruneOldPageVersions.groovy:128) 
       at com.onresolve.scriptrunner.canned.confluence.jobs.PruneOldPageVersions$_doScript_closure3.doCall(PruneOldPageVersions.groovy:110) 
       at com.onresolve.scriptrunner.canned.confluence.jobs.PruneOldPageVersions$_doScript_closure3.doCall(PruneOldPageVersions.groovy) 
       at com.onresolve.scriptrunner.jobs.AbstractConfluenceCustomScheduledJob$_switchIndentityAndExecute_closure1.doCall(AbstractConfluenceCustomScheduledJob.groovy:29) 
       at com.onresolve.scriptrunner.jobs.AbstractConfluenceCustomScheduledJob$_switchIndentityAndExecute_closure1.doCall(AbstractConfluenceCustomScheduledJob.groovy) 
       at com.atlassian.confluence.user.AuthenticatedUserImpersonator$2.call(AuthenticatedUserImpersonator.java:118) 
       at com.atlassian.confluence.user.AuthenticatedUserImpersonator$1.call(AuthenticatedUserImpersonator.java:101) 
       at com.atlassian.confluence.user.AuthenticatedUserImpersonator.asUser(AuthenticatedUserImpersonator.java:82) 
       at com.atlassian.confluence.user.AuthenticatedUserImpersonator$asUser.call(Unknown Source) 
       at com.onresolve.scriptrunner.jobs.AbstractConfluenceCustomScheduledJob.switchIndentityAndExecute(AbstractConfluenceCustomScheduledJob.groovy:28) 
       at com.onresolve.scriptrunner.jobs.AbstractConfluenceCustomScheduledJob$switchIndentityAndExecute.callCurrent(Unknown Source) 
       at com.onresolve.scriptrunner.canned.confluence.jobs.PruneOldPageVersions.doScript(PruneOldPageVersions.groovy:100) 
      Caused by: net.sf.hibernate.StaleObjectStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 at org.hibernate.internal.ExceptionConverterImpl.wrapStaleStateException(ExceptionConverterImpl.java:212) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:86) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)
       at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1411)
       at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:475)
       at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3168)
       at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2382)
       at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:467) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
       at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:220)
       at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
       at com.atlassian.hibernate.adapter.adapters.TransactionV2Adapter.commit(TransactionV2Adapter.java:30)
       at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:510)
        ... 26 more
      

        Attachments

          Activity

            People

            Assignee:
            lparsons Luke Parsons [X] (Inactive)
            Reporter:
            scheesley Stephen Cheesley
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: