Parallel changes of a non-local variable fails


is it possible to set a non-local variable in several service tasks via exection.setVariable() in parallel? I get a primary key violation in the ACT_RU_VARIABLE table when I try to do this.

"### Error updating database.  Cause: org.h2.jdbc.JdbcSQLException: Eindeutiger Index oder Primärschlüssel verletzt: "ACT_UNIQ_VARIABLE_INDEX_C ON PUBLIC.ACT_RU_VARIABLE(VAR_SCOPE_, NAME_)"
Unique index or primary key violation: "ACT_UNIQ_VARIABLE_INDEX_C ON PUBLIC.ACT_RU_VARIABLE(VAR_SCOPE_, NAME_)"; SQL statement:
insert into ACT_RU_VARIABLE..."

Is it even possible to set process global variables in parallel threads?

Thanks in advance!


1 Like

Hi Carsten,

the process engine ensures that a process variable is unique in their scope to avoid inconsistency. So it is not possible to create a process variable in parallel executions within one transaction. If you have to modify a process variable in parallel executions then you should create the variable before and split the transactions via wait state or asynchronous continuation.

Does this help you?

Best regards,

Hi Philipp,

thanks for your hint. This solves my problem.

Best regards,