cancel
Showing results for 
Search instead for 
Did you mean: 

Got integrity constraint violation after process execution

lossril
Champ in-the-making
Champ in-the-making
Hello,
I've got pretty weird bug in my Activiti system.
After the process instance is completed (everything worked pretty much smoothly, no errors) this happens:

[ERROR] 2016-07-14 11:00:17,273 org.activiti.rest.exception.ExceptionHandlerAdvice handleOtherException - Unhandled exception
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (ACTIVITI.ACT_FK_TSKASS_TASK) violated - parent key not found

### The error may involve org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.bulkInsertIdentityLink_oracle-Inline
### The error occurred while setting parameters
### SQL: INSERT ALL                  into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_) VALUES            (?,             1,             ?,             ?,             ?,             ?,             ?,             ?)                  into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_) VALUES            (?,             1,             ?,             ?,             ?,             ?,             ?,             ?)             SELECT * FROM dual
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (ACTIVITI.ACT_FK_TSKASS_TASK) violated - parent key not found

All of the process parts were completed successfully, the process is not a subprocess of a bigger process.
Process itself has nothing complicated in it - here is the screenshot of the definition :
[img]https://ibin.co/2o0iFzqD19vG.png[/img]
Both reports (those two subprocesses at the end) ended correctly, but then the exception happens and the process instance rolls back.
It occurs every time if subprocesses are completed smoothly, but if something in subprocess goes wrong and administrator decision by user task completion is required, the process instance is completed successfully after user task completion.

I suppose, that's the Activiti bug.
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Can you reproduce the issue in the jUnit test?
https://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin

gauravkumar1382
Champ in-the-making
Champ in-the-making

Hi,

I am also getting exactly the same error. The issue comes when the same user task within the event subprocess is called after an boundary error event caught some error in the event subprocess. When i am trying to complete that user task for the second time and after that is updates the task id for the next user task in the activiti tables ACT_RU_TASK and ACT_RU_IDENTITYLINK. So, while saving in oracle database, It is trying to update ACT_RU_IDENTITYLINK table first with the new task id instead of updating ACT_RU_TASK table first. Since task id column is a foreign key in ACT_RU_IDENTITYLINK table, it is not able to find its parent in ACT_RU_TASK table. Hence, i am getting this integrity exception.

Note:

I don't know the sequence in which table updation works.

I am not getting the exception when user task is completed for the first time in subprocess.

I do not have the junit for this but i pritty much explained the scenario.

To give you more information on how i am getting the exception within event subprocess is that after the user task which will set some form properties, i have an exclusive gateway and while completing the user task i am not setting the form property in the above user task which will be used for condition in exclusive gateway. So, my flow comes in boundary error event and after that i am having a user task outside event subprocess which will set that property used by exclusive gateway. After this property is set, i will direct to same event subprocess again. So now, the exclusive gateway part is getting executed properly and when the new task gets created for next user task after exclusive gateway, i get this integrity violation exception while saving in database tables.

Hi,

To modify my above comment as i got the root cause is, there was two sequence flow from my user task. One sequence flow was going to error end even and the other was going to an exclusive gateway.

I was getting the above error as soon as i was completing the user task irrespective of happy scenario or missing scenario.