AnsweredAssumed Answered

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

Question asked by mcajvar on Apr 19, 2016
Latest reply on May 31, 2016 by jbarrez
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.

Attachments

Outcomes