Batch Processing failing during load test with BatchUpdateException

I am getting an issue while performing a load test on my process having external task activity.

DB: Postgres 9.6.10
Camunda : 7.11.0
Spring boot: 2.1.5. RELEASE

After analyzing the issue, I get to know batch processing is happening while completing an external task to push execution entries in history tables.

Batch process is having related statements. For which exception is coming.

Stack trace for the problem is this: -

. Flush summary:
[
INSERT HistoricVariableInstanceEntity[feec03d7-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableInstanceEntity[feec2ae9-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableInstanceEntity[feec2aeb-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableInstanceEntity[feec2aed-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableUpdateEventEntity[feec2ae8-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableUpdateEventEntity[feec2aea-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableUpdateEventEntity[feec2aec-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricVariableUpdateEventEntity[feec2aee-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricExternalTaskLogEntity[feee26bf-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricExternalTaskLogEntity[fef13403-2172-11ea-ae64-6297474a9cc6]
INSERT HistoricActivityInstanceEventEntity[Task_0slykjj:fef13401-2172-11ea-ae64-6297474a9cc6]
INSERT ExecutionEntity[fef13400-2172-11ea-ae64-6297474a9cc6]
INSERT VariableInstanceEntity[feec03d7-2172-11ea-ae64-6297474a9cc6]
INSERT VariableInstanceEntity[feec2ae9-2172-11ea-ae64-6297474a9cc6]
INSERT VariableInstanceEntity[feec2aeb-2172-11ea-ae64-6297474a9cc6]
INSERT VariableInstanceEntity[feec2aed-2172-11ea-ae64-6297474a9cc6]
INSERT ExternalTaskEntity[fef13402-2172-11ea-ae64-6297474a9cc6]
DELETE ExternalTaskEntity[3d820193-2172-11ea-ae64-6297474a9cc6]
UPDATE ExecutionEntity[fd4e6ba3-2170-11ea-a57f-bead4740b828]
DELETE ExecutionEntity[3d820191-2172-11ea-ae64-6297474a9cc6]
UPDATE HistoricActivityInstanceEventEntity[Task_1ywtn7a:3d820192-2172-11ea-ae64-6297474a9cc6]
]
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:362) ~[camunda-engine-7.11.0.jar!/:7.11.0]
:
at org.camunda.bpm.engine.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:56) ~[camunda-engine-7.11.0.jar!/:7.11.0]
at org.camunda.bpm.engine.rest.sub.externaltask.impl.ExternalTaskResourceImpl.complete(ExternalTaskResourceImpl.java:118) ~[camunda-engine-rest-core-7.11.0.jar!/:7.11.0]
:
:
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “act_ru_execution” violates foreign key constraint “act_fk_ext_task_exe” on table “act_ru_ext_task”
Detail: Key (id_)=(3d820191-2172-11ea-ae64-6297474a9cc6) is still referenced from table “act_ru_ext_task”.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.5.jar!/:42.2.5]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) ~[postgresql-42.2.5.jar!/:42.2.5]
… 101 common frames omitted

While commiting the batch process it is trying to remove an entry from act_ru_execution table which is violating because of the entry present in act_ru_ext_task table. The act_ru_ext_task entry is also part of the same batch process only.
DELETE ExternalTaskEntity[3d820193-2172-11ea-ae64-6297474a9cc6] we can see in the logs.

Could anyone please help me out to resolve this issue?

Similar Issue I found here

@thorben @Ingo_Richtsmeier @nikola.koevski

Thanks in Advance.:slight_smile:

Please format your post properly, if it’s hard to read whats going on, it’s going to be hard to answer it.

logs-from-camunda-in-camunda-deployment-bb855c94c-s2slf (1).txt (108.3 KB)

Attaching logs file for more information.

Formatted the content. Actually stack trace is big here.

Take a look at this markdown guide for more details on better formatting
Also - the title could do with some work, just posting a bit of a stack trace doesn’t really help. give more context to what the problem is. In human readable English.