MySQL deadlock

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

Deployment environment in queue state

The following appears in the atlassian-bamboo.log

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2017-08-30 15:45:24,062 ERROR [17-BAM::Default Agent::Agent:pool-32-thread-1] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.deployments.execution.events.OutOfBandDeploymentTimingPoints$AgentAssigned@333850d7] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.bamboo.deployments.execution.events.DeploymentExecutionEventListener.onDeploymentExecuted(com.atlassian.bamboo.deployments.execution.events.OutOfBandDeploymentTimingPoints$AgentAssigned), listener=com.atlassian.bamboo.deployments.execution.events.DeploymentExecutionEventListener@3b405fe3}] java.lang.RuntimeException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection 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:34) 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.event.TxAwareEventPublisher.publish(TxAwareEventPublisher.java:20) at com.atlassian.bamboo.v2.build.timing.TimingPointServiceImpl.publish(TimingPointServiceImpl.java:31) at com.atlassian.bamboo.v2.build.timing.TimingPointServiceImpl.publish(TimingPointServiceImpl.java:21) at com.atlassian.bamboo.execution.ExecutionPhaseServiceImpl.agentAssigned(ExecutionPhaseServiceImpl.java:64) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:97) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:47) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.transaction.TransactionSystemException: Could not commit Hibernate transaction; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection ... Caused by: org.hibernate.TransactionException: Unable to commit against JDBC Connection ... Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

Diagnosis

Confirm if MySQL is configured with READ-COMMITTED with the following query:

1 SELECT @@session.tx_isolation;

Cause

MySQL have to be configured with READ-COMMITTED transaction level as stated in Connect Bamboo to a MySQL database.

Solution

Resolution

  1. Configured MySQL server to use READ-COMMITTED transaction level, for example:

    1 2 [mysqld] transaction-isolation=READ-COMMITTED
  2. Restart MySQL server

  3. Restart Bamboo

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.