Issues with external tasks on Postgres cluster

Hello everyone.

Recently our team started actively using Camunda and we noticed that some of the external tasks were failing to complete with following error:

org.camunda.bpm.engine.BadUserRequestException: External Task 3ca93783-16bf-11ec-9264-0242ac110020 cannot be completed by worker 'bpm'. It is locked by worker 'null'.
	at org.camunda.bpm.engine.impl.cmd.HandleExternalTaskCmd.execute(HandleExternalTaskCmd.java:52) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.cmd.HandleExternalTaskCmd.execute(HandleExternalTaskCmd.java:31) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46) ~[camunda-engine-spring-7.12.0.jar!/:7.12.0]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44) ~[camunda-engine-spring-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:56) ~[camunda-engine-7.12.0.jar!/:7.12.0]
	at org.camunda.bpm.engine.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:48) ~[camunda-engine-7.12.0.jar!/:7.12.0]

We assume that the reason behind that is a PostgreSQL cluster that we are using. (with pgpool)
Engine saves a task and its parameters, then tries to load it back and complete it, but data has not been replicated yet to a DB from which data is being read.
It happens every time pool runs out of connections and requests a new one.
Using “serializable” transaction level also results in error in Camunda engine.

Is there any solution for this issue?

Thanks.

1 Like