cancel
Showing results for 
Search instead for 
Did you mean: 

MultiThread - same variable created many times on the same process instance

qcap
Champ in-the-making
Champ in-the-making
Hello,

On our diagram, we use a ReceiveNode to wait all responses from outside to decide what to do next.

We use JMS to trigger the ReceiveNode, it do
- search Execution of  ReceiveNode,  we know Execution by querying on it's name.
- runtimeService.setVariable() on Execution. This variable is used to decide what to do next.
- runtimeService.signal(execution) to go ahead.

I can see that when we have the message JMS, the variable is set correctly with the right value and revision's number  ( 0 then 1 then 2 … ) when value changed.
But when have many JMS message on the same execution ( multithreading), I can see that activiti create the same variable with the same revision number. Until, it's not a problem.

But the process is never ended, it failed when try to  end the process, it try to clean all variables and save them on history,

### The error occurred while setting parameters
### SQL: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`activiti`.`act_ru_variable`, CONSTRAINT `ACT_FK_VAR_EXE` FOREIGN KEY (`EXECUTION_ID_`) REFERENCES `ACT_RU_EXECUTION` (`ID_`))
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

I think it caused by a double of variable on the same revision.

On the diagram, we use timer to end the process automatically, it failed becaused of above error and il rollback on the same node. So the same scenario is produced INFINITELY.

The cased is produced also on oracle/linux.

Thanks for your helps.








 












10 REPLIES 10

jcoveron
Champ in-the-making
Champ in-the-making
Hi Tijs,

First of all, thank you for your fast reply.

We modified both both parallel gateways and modified them to have activiti:async="true" and activiti:exclusive="true". Unfortunately, the result is the same. We get the foreign key constraint. I am attaching the process xml as a reference.

For know, as a workaround, we will remove the foreign key constraints until we can do further testing. If you want, we can run some test that you would like us to perform.

Again, many thanks for your help.

Best regards,

José