Primary key constraints on ACT_RU_VARIABLE table

We get this exception when the transaction commits in the BPMN. Looks like the variable is duplicated in the BPMN but the error is not very clear on the variable details.

We have a very complex flow with several subprocess, what is the best way to identify the details of the variable that get’s duplicated.

2016-04-16 13:46:58,962 [] [server1] [Grizzly-worker(5)] ] [346361a2-8755-47af-af03-4dd48a65f040] ERROR org.camunda.bpm.engine.impl.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:

Error updating database. Cause: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 3;UAT1_001_WF_ENGINE.ACT_RU_VARIABLE

The error may involve org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance-Inline

The error occurred while setting parameters

SQL: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_, VAR_SCOPE_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 3;UAT1_001_WF_ENGINE.ACT_RU_VARIABLE

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)
at org.camunda.bpm.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:667)
at org.camunda.bpm.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:487)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:196)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:126)
at com..ep.workflow.engine.camunda.InternalProcessEngineConfiguration$1$1.lambda$MR$close$close$c0a1be38$1(InternalProcessEngineConfiguration.java:148)
at com..ep.workflow.engine.camunda.InternalProcessEngineConfiguration$1$1$$Lambda$67/609471415.run(Unknown Source)
at com..ep.workflow.engine.util.OperationTimer$OperationTimerInstance.withSegment(OperationTimer.java:118)
at com..ep.workflow.engine.util.OperationTimer.withSegment(OperationTimer.java:40)
at com..ep.workflow.engine.camunda.InternalProcessEngineConfiguration$1$1.close(InternalProcessEngineConfiguration.java:148)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:99)
at com..ep.workflow.engine.camunda.InternalProcessEngineConfiguration$CustomTransactionInterceptor.lambda$execute$21(InternalProcessEngineConfiguration.java:220)
at com..ep.workflow.engine.camunda.InternalProcessEngineConfiguration$CustomTransactionInterceptor$$Lambda$66/657986711.doInTransaction(Unknown Source)

Hi @Lakshmanan,

it seems that you are right and the process engine tries to insert a process variable with the same name for the same execution twice. To analyse the problem you have to find the related process variable and when it is inserted.

You can switch on the logging to see the SQL statements and find the name of the process variable.

<logger name="org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity" level="debug" />

(ensure that mybatis uses SLF4J)

When you find the process variable then please share the part of the process that causes the exception.

Greetings,
Philipp

Thanks for your help. Will share once we find the root cause.

LV