deadlock in Bamboo
Asked by Richard Jones:

Hi All

I'm sure this is the wrong place to post this so please move to the correct place (I couldnt see where to post). We just received a deadlock in our bamboo instance. I have restarted bamboo and all is good now. THe stack trace is below. I thought you might want to have the stack trace for your records.

Thanks

Build UA QA - Refresh XX YYY ZZZ 19 : Errors getting changes for XXREL-RGUR-19

(org.springframework.dao.CannotAcquireLockException : Could not execute JDBC batch update; SQL \[insert into REPOSITORY_CHANGESET (BUILDRESULTSUMMARY_ID, VCS_LOCATION_ID, CHANGESET_ID, SKIPPED_COMMITS_COUNT, LIST_POSITION, BUILD_TRIGGER, REPOSITORY_CHANGESET_ID) values (?, ?, ?, ?, ?, ?, ?)\]; nested exception is org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update)

Occurred: 27 Nov 2015, 3:02:53 AM

________________________________________

org.springframework.dao.CannotAcquireLockException: Could not execute JDBC batch update; SQL \[insert into REPOSITORY_CHANGESET (BUILDRESULTSUMMARY_ID, VCS_LOCATION_ID, CHANGESET_ID, SKIPPED_COMMITS_COUNT, LIST_POSITION, BUILD_TRIGGER, REPOSITORY_CHANGESET_ID) values (?, ?, ?, ?, ?, ?, ?)\]; nested exception is org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update

at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:650)

at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:799)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:669)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)

at com.sun.proxy.$Proxy25.commit(Unknown Source)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy59.updateResultSummaryWithBuildChanges(Unknown Source)

at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:235)

at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:278)

at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:214)

at sun.reflect.GeneratedMethodAccessor2823.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

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.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy145.delayedStart(Unknown Source)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1$1.run(PlanExecutionManagerImpl.java:430)

at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:83)

at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:79)

at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:101)

at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:78)

at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:118)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:425)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:417)

at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)

at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:800)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$300(PlanExecutionManagerImpl.java:129)

at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1.run(PlanExecutionManagerImpl.java:411)

at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)

at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)

at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)

at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)

at java.lang.Thread.run(Thread.java:744)

Caused by: org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:107)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)

at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)

at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)

at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2412)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2875)

at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)

at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)

at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)

at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)

at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)

at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:661)

... 45 more

Caused by: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction

at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1799)

at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1271)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)

at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)

at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)

... 60 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)

at com.mysql.jdbc.Util.getInstance(Util.java:383)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2113)

at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1767)

... 64 more

-

*[Build UA QA - Refresh GV UAT RAC 19](http://dev-gosling:8085/browse/GVREL-RGUR-19) :* Errors getting changes for GVREL-RGUR-19

(org.springframework.dao.CannotAcquireLockException : Could not execute JDBC batch update; SQL \[insert into REPOSITORY_CHANGESET (BUILDRESULTSUMMARY_ID, VCS_LOCATION_ID, CHANGESET_ID, SKIPPED_COMMITS_COUNT, LIST_POSITION, BUILD_TRIGGER, REPOSITORY_CHANGESET_ID) values (?, ?, ?, ?, ?, ?, ?)\]; nested exception is org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update)

<br />

Occurred: 27 Nov 2015, 3:02:53 AM  

*** ** * ** ***

```
org.springframework.dao.CannotAcquireLockException: Could not execute JDBC batch update; SQL [insert into REPOSITORY_CHANGESET (BUILDRESULTSUMMARY_ID, VCS_LOCATION_ID, CHANGESET_ID, SKIPPED_COMMITS_COUNT, LIST_POSITION, BUILD_TRIGGER, REPOSITORY_CHANGESET_ID) values (?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
```

```
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:650)
```

```
        at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:799)
```

```
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:669)
```

```
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
```

```
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
```

```
        at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
```

```
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
```

```
        at java.lang.reflect.Method.invoke(Method.java:606)
```

```
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
```

```
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
```

```
        at com.sun.proxy.$Proxy25.commit(Unknown Source)
```

```
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)
```

```
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)
```

```
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
```

```
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
```

```
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
```

```
        at com.sun.proxy.$Proxy59.updateResultSummaryWithBuildChanges(Unknown Source)
```

```
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:235)
```

```
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:278)
```

```
        at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:214)
```

```
        at sun.reflect.GeneratedMethodAccessor2823.invoke(Unknown Source)
```

```
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
```

```
        at java.lang.reflect.Method.invoke(Method.java:606)
```

```
        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.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
```

```
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
```

```
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
```

```
        at com.sun.proxy.$Proxy145.delayedStart(Unknown Source)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1$1.run(PlanExecutionManagerImpl.java:430)
```

```
        at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:83)
```

```
        at com.atlassian.bamboo.util.CacheAwareness$2.call(CacheAwareness.java:79)
```

```
        at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:101)
```

```
        at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:78)
```

```
        at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:118)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:425)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:417)
```

```
        at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:800)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$300(PlanExecutionManagerImpl.java:129)
```

```
        at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1.run(PlanExecutionManagerImpl.java:411)
```

```
        at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
```

```
        at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
```

```
        at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
```

```
        at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
```

```
        at java.lang.Thread.run(Thread.java:744)
```

```
Caused by: org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
```

```
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:107)
```

```
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
```

```
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
```

```
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
```

```
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
```

```
        at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
```

```
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2412)
```

```
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2875)
```

```
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
```

```
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
```

```
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
```

```
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
```

```
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
```

```
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
```

```
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
```

```
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
```

```
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
```

```
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:661)
```

```
        ... 45 more
```

```
Caused by: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
```

```
        at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1799)
```

```
        at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1271)
```

```
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
```

```
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
```

```
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
```

```
        ... 60 more
```

```
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
```

```
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
```

```
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
```

```
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
```

```
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
```

```
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
```

```
        at com.mysql.jdbc.Util.getInstance(Util.java:383)
```

```
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
```

```
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
```

```
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
```

```
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
```

```
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
```

```
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
```

```
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)
```

```
        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2113)
```

```
        at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1767)
```

```
        ... 64 more
```

-  


Answers:
author: Greg Bailey
body: Richard did you ever get a resolutoin for this error? We have hit this same issue a few times in our local Bamboo instance recently.


author: Mike Friedrich
body: Report this please using your Atlassian support. We can't move anything here. This questions/answers site is mostly community driven. Also, please don't pollute the system by posting giant stack traces. In Atlassian support you can use attachments.


Tags: bamboo-administration

deadlock