cancel
Showing results for 
Search instead for 
Did you mean: 

After finishing multi instance user task, tasks sometimes remain in the database, causing integrity constraint violation

mcajvar
Champ in-the-making
Champ in-the-making
Hello,

I have a problem when completing tasks. We have a process (see attachment) with some tasks to handle a request. There is also a multi instance user task where people can decide to ignore or accept the request. If it is rejected, an error end event is triggered, which does some cleanup, sends an email and ends the process. In theory…

The request is handled by a Java method, which sets some variables and then proceeds to complete the task. If the task is completed without providing a Map of variables, things work, apart from not having the variables stored. If the task is completed by also providing a set of changed variables, where the process proceeds to exit the subprocess and continue to the end event, an error occurs:
13:31:00.281 [up-pool-37] [user@localdomain] DEBUG o.a.e.i.interceptor.CommandContext - Error while closing command context
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found

### 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_ = ? and REV_ = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found

I have also added some output to various points in the process, namely before completing the multi instance task (usertaskSkrbnikPregledSredstev), while evaluating the flow condition (flow93) and in the service task (servicetaskPreklicRezervacijArhiv). In all cases the output is the same:
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Instance name: null, description: null, parent id: null
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Execution name: null, description: null, suspended: false, activity id: servicetaskPreklicRezervacijArhiv, parent id: null
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Execution name: null, description: null, suspended: false, activity id: podprocesNmv, parent id: 12511
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Execution name: null, description: null, suspended: false, activity id: null, parent id: 12584
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Execution name: null, description: null, suspended: false, activity id: errorendeventZavrnitevSkrbnikovSredstev, parent id: 12584
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Task name: Skrbnik sredstev: pregled sredstev, description: null, suspended: false, delegation state: null, assignee: mcajvar, form key: skrbnikSredstevPregledSredstev, id: 12605, parent task id: null
15:21:02.333 [up-pool-45] [] INFO  s.u.fri.up.service.nmv.NmvService - Process data: instance id = 12511; instance count = 1, executions = 4, tasks = 1

Which is weird, as I would expect no more active tasks when entering the exclusive gateway. In the attached process, after leaving the multi instance task, a task remains in the database and that is why I believe it fails upon trying to end the process going the error event way. If the process continues using the default flow, the subprocess never finishes, because there still appear to be active tasks (from the multi instance user task).

As stated above, I tried completing the task in 2 ways:

            taskService.complete(taskId, variables); // this fails
            taskService.complete(taskId); // this works, but I lose my variables


If it helps, I have also attached a part of the log file, from "CompleteTaskCmd" until the error.

I have tried using a Terminate End Event with terminateAll, but in that case the process was left without and end time and was not seen as finished. This has already been fixed if I noticed correctly, but not yet released (when is 5.20.0 approximately planned for release?).

I have also tried to reduce the process to as few elements as possible and still reliably bump into the error. However, when I tried to prepare a unit test, I was unable to reproduce the problem.

I am using Oracle XE and Activiti 5.19.0.2. The diagram has been constructed using Activiti Designer.

I would be grateful for any help and if there is any further information I can provide I would be happy to do so. If I am unable to prepare a unit test, I would have no problems with arranging a TeamViewer session or something like that if need be.
6 REPLIES 6

trademak
Star Contributor
Star Contributor
Hi,

Did you try to use a multi instance sub process with an error boundary event instead of using the multi instance user task? I think that better aligns with your requirements. Activiti 5.20.0 is released so you could try that Engine version as well. A terminate end event would be needed if you want to stop all multi instance executions.

Best regards,

mcajvar
Champ in-the-making
Champ in-the-making
Hi,

no, I didn't use a multi instance subprocess. The real process is actually a bit more complex, with lots of other user and service tasks. This is just a stripped down version which I was hoping to use for a unit test. But it is still valid as it still fails.

The multi instance user task is actually just a simple form where some data is displayed to one or more people and they either confirm or reject that info. I set a variable depending on that input and that's it. I use some other multi instance user tasks in the process, but only this one causes me problems.

Thank you for info on 5.20.0 being released, I will have a look. Although I don't really believe the appropriate way to solve the issue is to force kill (stale) tasks at the end.

mcajvar
Champ in-the-making
Champ in-the-making
Having tried Activiti 5.20.0 and swapping End Events with Terminate End Events with activiti:terminateAll="true" thrown in for good measure, the error occurs anyway.
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found

### 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_ = ? and REV_ = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found

If I throw out the multi instance loop characteristic and only have a plain user task, everything is OK, with both Terminate End Events or normal End Events…

jbarrez
Star Contributor
Star Contributor
First off all: I'm agreeing with Tijs here that the paradigm you're trying to express here (mi task with error throw) is better modeled as an embedded subprocess.
Secondly, can you post a unit test on how to reproduce this? It's already quite a process (with custom service task) and setting this up takes some time on our end.

venkatesh
Champ in-the-making
Champ in-the-making
Hi,

can u give me some idea to end the multiInstance parallel task in a subProcess.
consider the scenorio tat i have Two tasks in multiInstance parallel .
i am completing one task and in service Task i am getting all the active tasks so, i will get the remaining task but when i tried to complete it i am getting ### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found

### 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_ = ? and REV_ = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (UP.ACT_FK_EXE_PARENT) violated - child record found.


case 2 :  after the userr task i am setting variable action="SENDBACK " and moving towards the service task and am jus ending with the terminateEndEvent . but the entire SubProcess event and tasks nt at terminating instead am getting completed wit only one task and nt all tasks . so it is still in subProcess not coming out of it untill unless i complete twice.

jbarrez
Star Contributor
Star Contributor
It's a pretty big process xml file … can you describe the steps how i can reproduce the error you're describing in a unit test?