We are using Camunda 7.8 (Spring Boot 1.5.8) with PostgreSQL 10.4.0
On heavy system load some external tasks cannot be completed and result in a deadlock.
This is how the external task is modelled:
On completion of the task additional variables are attached to the process instance.
The database logs something like this:
Process 781 waits for ShareLock on transaction 8165578; blocked by process 650.
Process 781: delete from ACT_RU_EXECUTION where ID_ = $1 and REV_ = $2
Process 650: delete from ACT_RU_EXECUTION where ID_ = $1 and REV_ = $2
CONTEXT: while deleting tuple (274,23) in relation "act_ru_execution"
ERROR: deadlock detected
I’m wondering why two database processes try to delete the same execution in this context. Is there a reason that I can try to understand or could this be a hint that we are doing something wrong?
As an additional question (if everything is fine with this behavior) I would like to know which exception to handle in order to configure our retry strategy. We already retry on OptimisticLockingExceptions but there seems to be no dedicated exception class for this kind.