com.atlassian.bamboo.plan.MovePlansException: org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only

Atlassian JIRA | Kah Loun Foong [Atlassian] | 6 months ago
  1. 0

    h3. Summary Moving certain plan will have the error "cannot save merged build definitions" h3. Steps to Reproduce # Create two Projects: ProjectA and ProjectB # Create PlanA in ProjectA and PlanB in ProjectB # Set PlanA to have produce a ArtifactA # Set PlanB to have "Artifact download" task to download ArtifactA # Create a branch plan in PlanB # Move PlanA from ProjectA to ProjectB h3. Expected Results Move successfully h3. Actual Results Move fail with the error message "Transaction rolled back because it has been marked as rollback-only" in the UI. The below exception is thrown in the atlassian-bamboo.log file: {noformat} 2016-06-08 16:35:18,441 INFO [http-nio-8085-exec-9] [TransactionalPlanMover] Finished updating artifacts 2016-06-08 16:35:51,616 ERROR [http-nio-8085-exec-9] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.chains.events.ChainMovingEvent[source=com.atlassian.bamboo.plan.move.TransactionalPlanMover@1830b4d9] plan=SHD-TOOL] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.bamboo.plugins.artifact.ArtifactDownloaderTaskEventListener.onChainMoving(com.atlassian.bamboo.chains.events.ChainMovingEvent), listener=com.atlassian.bamboo.plugins.artifact.ArtifactDownloaderTaskEventListener@129d624c}] java.lang.RuntimeException: cannot save merged build definitions at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:46) at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:105) at com.atlassian.bamboo.event.spi.BambooEventDispatcher.dispatch(BambooEventDispatcher.java:38) at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:260) at com.atlassian.event.internal.LockFreeEventPublisher.publish(LockFreeEventPublisher.java:102) at com.atlassian.bamboo.plan.move.TransactionalPlanMover$1.run(TransactionalPlanMover.java:281) at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:192) at com.atlassian.bamboo.plugin.BambooPluginUtils$Runnable.call(BambooPluginUtils.java:182) at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:132) at com.atlassian.bamboo.plan.move.TransactionalPlanMover.publishChainMovingEvent(TransactionalPlanMover.java:276) at com.atlassian.bamboo.plan.move.TransactionalPlanMover.moveSinglePlan(TransactionalPlanMover.java:202) at com.atlassian.bamboo.plan.move.TransactionalPlanMover.moveMaster(TransactionalPlanMover.java:139) ... Caused by: java.lang.IllegalArgumentException: cannot save merged build definitions at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) at com.atlassian.bamboo.plan.PlanHibernateDao.save(PlanHibernateDao.java:456) at com.atlassian.bamboo.plan.PlanHibernateDao.save(PlanHibernateDao.java:51) at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ... 2016-06-08 16:35:51,916 ERROR [http-nio-8085-exec-9] [MoveBuilds] Unable to move plans com.atlassian.bamboo.plan.MovePlansException: org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only at com.atlassian.bamboo.plan.move.MovePlanBatchCoordinator.movePlans(MovePlanBatchCoordinator.java:58) at com.atlassian.bamboo.plan.move.MovePlanServiceImpl.movePlansToProject(MovePlanServiceImpl.java:37) at com.atlassian.bamboo.ww2.actions.build.admin.MoveBuilds.execute(MoveBuilds.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) {noformat} h3.Workaround # Click on the Move button again OR # Remove the "Artifact download" task first before moving the plan again h3. Notes # The first workaround depends on the number of tasks and branch plans #* If there are two "Artifact download" tasks to download ArtifactA and two branch plans in PlanB, the number of time to click on the Move button is (2 x 2 + 1) = 5 #* If there are other plans with "Artifact download" tasks that will download ArtifactA and have branch plans as well, the number will increase too, eg: PlanB have 2 "Artifact download" tasks and 2 branch plans = 2 x 2 = 4 PlanC have 3 "Artifact download" tasks and 4 branch plans = 3 x 4 = 12 Total number to click Move button = 4 + 12 + 1 # Incorrect setting in "Artifact download" task #* If PlanB have two stages and both stages have "Artifact download" task to download ArtifactA, only the second stage in PlanB is updated to refer to the correct project. The first stage is still referring to the ProjectA #* Running the build will have an error even though the "Artifact download" task is disabled

    Atlassian JIRA | 6 months ago | Kah Loun Foong [Atlassian]
    com.atlassian.bamboo.plan.MovePlansException: org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only

    Root Cause Analysis

    1. com.atlassian.bamboo.plan.MovePlansException

      org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only

      at com.atlassian.bamboo.plan.move.MovePlanBatchCoordinator.movePlans()
    2. com.atlassian.bamboo
      MoveBuilds.execute
      1. com.atlassian.bamboo.plan.move.MovePlanBatchCoordinator.movePlans(MovePlanBatchCoordinator.java:58)
      2. com.atlassian.bamboo.plan.move.MovePlanServiceImpl.movePlansToProject(MovePlanServiceImpl.java:37)
      3. com.atlassian.bamboo.ww2.actions.build.admin.MoveBuilds.execute(MoveBuilds.java:158)
      3 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames