AnsweredAssumed Answered

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

Question asked by qcap on Jan 9, 2014
Latest reply on Apr 8, 2015 by jcoveron
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.








 












Outcomes