From time to time on our client environment org.hibernate.exception.LockAcquisitionException appears.
It happens whe we call org.flowable.engine.impl.cmd.SubmitTaskFormCmd to finish the workflow.
We use Postgres as DB + hibernate 5.x
Stacktrace:
2019-06-17 14:53:13.471 [https-jsse-nio-0.0.0.0-5124-exec-79] ERROR o.a.e.i.interceptor.CommandContext - Error while closing command context
*org.apache.ibatis.exceptions.PersistenceException: *
### Error updating database. Cause: org.hibernate.exception.LockAcquisitionException: ERROR: deadlock detected
- Detail: Process 18694 waits for ShareLock on transaction 32676363; blocked by process 21459.*
Process 21459 waits for ShareLock on transaction 32655868; blocked by process 18694. - Hint: See server log for query details.*
- Where: while deleting tuple (4,42) in relation “act_ru_execution”*
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline
### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: org.hibernate.exception.LockAcquisitionException: ERROR: deadlock detected - Detail: Process 18694 waits for ShareLock on transaction 32676363; blocked by process 21459.*
Process 21459 waits for ShareLock on transaction 32655868; blocked by process 18694. - Hint: See server log for query details.*
- Where: while deleting tuple (4,42) in relation “act_ru_execution”*
- 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.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213)*
- at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:237)*
- at org.activiti.engine.impl.db.DbSqlSession.flushRegularDeletes(DbSqlSession.java:882)*
- at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:849)*
- at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:564)*
- at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:210)*
- at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:136)*
- at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:68)*
- at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:49)*
- at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)*
- at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:46)*
- at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)*
- at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)*
- at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:46)*
- at org.activiti.engine.impl.FormServiceImpl.submitTaskFormData(FormServiceImpl.java:78)*
- at org.flowable.compatibility.DefaultFlowable5CompatibilityHandler.submitTaskFormData(DefaultFlowable5CompatibilityHandler.java:733)*
- at com.collibra.dgc.core.workflow.activiti.extensions.command.SubmitTaskFormCmd.execute(SubmitTaskFormCmd.java:30)*
- at com.collibra.dgc.core.workflow.activiti.extensions.command.SubmitTaskFormCmd.execute(SubmitTaskFormCmd.java:18)*
- at org.flowable.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:58)*
- at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51)*
- at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93)*
- at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)*
- at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)*
- at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)*
- at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)*
- at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71)*
- at com.collibra.dgc.core.workflow.activiti.extensions.CacheSupportedSpringTransactionInterceptor.lambda$execute$0(CacheSupportedSpringTransactionInterceptor.java:36)*
- at com.collibra.dgc.core.cache.transaction.CacheSupportedTransactionTemplate.execute(CacheSupportedTransactionTemplate.java:67)*
- at com.collibra.dgc.core.exceptions.ExceptionResolvingWithCachingTransactionTemplate.execute(ExceptionResolvingWithCachingTransactionTemplate.java:37)*
- at com.collibra.dgc.core.workflow.activiti.extensions.CacheSupportedSpringTransactionInterceptor.execute(CacheSupportedSpringTransactionInterceptor.java:36)*
- at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)*
- at com.collibra.dgc.core.workflow.activiti.extensions.CustomCommandInterceptor.execute(CustomCommandInterceptor.java:23)*
- at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)*
- at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)*
- at com.collibra.dgc.core.workflow.activiti.WorkflowEngineImpl.submitTaskFormData(WorkflowEngineImpl.java:573)*
Do you have any idea what could be the reason of this deadlock?