cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to complete parallel task (foreign key violation)

risto45
Champ in-the-making
Champ in-the-making
I have a problem that seems like a bug, but I'm not sure - maybe I'm doing something wrong.

I have two parallel tasks. During the execution some variables are added to the tasks using
taskService.setVariableLocal(taskId, variable, value). And now when I call taskService.complete(taskId)
on one of the tasks, I get the following error:

org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable" Detail: Key (id_)=(17126) is still referenced from table "act_ru_variable". ### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline ### The error occurred while setting parameters ### SQL: delete from ACT_RU_EXECUTION where ID_ = ? ### Cause: org.postgresql.util.PSQLException: ERROR: update or delete on table "act_ru_execution" violates foreign key constraint "act_fk_var_exe" on table "act_ru_variable" Detail: Key (id_)=(17126) is still referenced from table "act_ru_variable".

Table act_ru_variable has a FOREIGN_KEY that references to act_ru_execution (id_).
And it seems that when I set the task to be complete(), then Activity tries to delete the execution from act_ru_execution before it deletes the task variables from act_ru_variables.

Is this a bug? Or has anyone ideas how to solve this.
Can I remove the foreign key - or does it mess up other things?

Many thanks,
Risto
4 REPLIES 4

meyerd
Champ on-the-rise
Champ on-the-rise
Hi risto45,

sounds like a bug. Could you maybe open an issue in JIRA and include a testcase?

risto45
Champ in-the-making
Champ in-the-making
Actually there is already an issue opened in JIRA with similar problem.
I simply updated it: https://jira.codehaus.org/browse/ACT-1054

Rgs,
Risto

risto45
Champ in-the-making
Champ in-the-making
I described the FOREIGN KEY violation a little wrong earlier.

What really happens is:
When I have a parallel task that contains two separate tasks: T1 and T2.
When T1 an T2 are executed, T1 gets execution ID 01 and T2 gets execution ID 02.
Now, during the execution I set couple of local variables for both, T1 and T2.
And when I set for example that T2 is completed (taskService.complete(T2.getId()), Activiti for some reason tries to delete
both executions 01 and 02. Allthough I guess it should only delete execution 02.
And since there are still local variable for T1 in act_ru_variable table, then system throws error: FOREIGN KEY violation.
Can't delete execution that has a local variables in act_ru_variable.

When I have a parallel task and I want to set one of them completed, why it tries to delete both executions?
Seems like a very common requirement? Can there really be such a bug. Or maybe I'm just doing something wrong.

Rgs,
Risto

roig
Champ in-the-making
Champ in-the-making
Any news on this? Did anyone mange to find a work around? May be delete the foreign key var or something?
10x all