Hi, m using Camunda 7.16 with Microsoft SQL Server 2017 14.0.3238.1.
Recently I have noticed in logs a few hundred instances of the following error occurring daily:
### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 244) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.JobEntity.selectNextJobsToExecute
### SQL: SELECT SUB.* FROM ( select RES.ID_, RES.REV_, RES.DUEDATE_, RES.PROCESS_INSTANCE_ID_, RES.EXCLUSIVE_ , row_number() over (ORDER BY RES.ID_ asc) rnk FROM ( select distinct RES.ID_, RES.REV_, RES.TYPE_, RES.LOCK_EXP_TIME_, RES.LOCK_OWNER_, RES.EXCLUSIVE_, RES.PROCESS_INSTANCE_ID_, RES.DUEDATE_, RES.PRIORITY_ from ACT_RU_JOB RES where (RES.RETRIES_ > 0) and ( RES.DUEDATE_ is null or RES.DUEDATE_ <= ? ) and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < ?) and RES.SUSPENSION_STATE_ = 1 and ( ( RES.EXCLUSIVE_ = 1 and not exists( select J2.ID_ from ACT_RU_JOB J2 where J2.PROCESS_INSTANCE_ID_ = RES.PROCESS_INSTANCE_ID_ -- from the same proc. inst. and (J2.EXCLUSIVE_ = 1) -- also exclusive and (J2.LOCK_OWNER_ is not null and J2.LOCK_EXP_TIME_ >= ?) -- in progress ) ) or RES.EXCLUSIVE_ = 0 ) )RES ) SUB WHERE SUB.rnk >= ? AND SUB.rnk < ? ORDER BY SUB.rnk
at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.lambda$executeSelectList$1(DbSqlSession.java:111) ~[camunda-engine-7.16.0.jar!/:7.16.0]
at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:254) ~[camunda-engine-7.16.0.jar!/:7.16.0]
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1770) ~[mssql-jdbc-8.2.2.jre8.jar!/:na]
this occurs everyday and although I did not notice anything unusual in engines behaviour (all processes are executed properly) this worries me a bit. From what I understand the job acquisition process was killed dur to deadlock, and after job acquisition interval has passed, a new acquisition was made successfully, hence the proper behaviour of engine, but nonetheless I would like to get rid of this issue, any ideas what might be causing it?