# Database Concurrent Problem

**URL:** <https://community.sonarsource.com/t/database-concurrent-problem/15509>\
**Category:** SonarQube Server / Community Build\
**Tags:** mysql, database\
**Created:** [October 16, 2019, 10:02am UTC](https://community.sonarsource.com/t/database-concurrent-problem/15509 "2019-10-16T10:02:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![neufeng](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/neufeng/32/6519_2.png) [@neufeng](https://community.sonarsource.com/u/neufeng)\
**Post date:** [October 16, 2019, 10:02am UTC](https://community.sonarsource.com/t/database-concurrent-problem/15509/1 "2019-10-16T10:02:42Z")

</div>

- SonarQube7.7, Scanner4.0

It seems woker peek may throw exceptions in some case, logs below

2019.10.16 15:27:54 ERROR ce[o.s.c.t.CeWorkerImpl] Failed to pop the queue of analysis reports  
org.apache.ibatis.exceptions.PersistenceException:

### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

### The error may involve org.sonar.db.ce.CeQueueMapper.updateIf-Inline

### The error occurred while setting parameters

### SQL: update ce\_queue set status=?, worker\_uuid=?, started\_at=?, updated\_at=? where uuid=? and status=?

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

```
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy27.updateIf(Unknown Source)
at org.sonar.db.ce.CeQueueDao.tryToPeek(CeQueueDao.java:178)
at org.sonar.db.ce.CeQueueDao.peek(CeQueueDao.java:173)
at org.sonar.ce.queue.InternalCeQueueImpl.peek(InternalCeQueueImpl.java:89)
at org.sonar.ce.taskprocessor.CeWorkerImpl.tryAndFindTaskToExecute(CeWorkerImpl.java:165)
at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:149)
at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:131)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:83)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:51)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

```

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:62)  
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)  
at com.mysql.jdbc.Util.getInstance(Util.java:408)  
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:952)  
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)  
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)  
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)  
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)  
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)  
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)  
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)  
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)  
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)  
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)  
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)  
at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52)  
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)  
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)  
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)  
… 19 common frames omitted

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [October 16, 2019, 11:31am UTC](https://community.sonarsource.com/t/database-concurrent-problem/15509/2 "2019-10-16T11:31:57Z")

</div>

Hi,

This error sounds really weird, and as the same time, as you’re using MySQL ([which is more used starting Sonarqube 7.9](https://community.sonarsource.com/t/end-of-life-of-mysql-support/8667)), I highly recommend you to [migrate to another database](https://github.com/SonarSource/mysql-migrator), as such error is one of the reason we do not support anymore this database.

I also recommend you to migrate to latest LTS 7.9.

Regards,
