AnsweredAssumed Answered

Errors inserting ACT_RU_IDENTITYLINK due to a MySQL constraint violation

Question asked by mnorman on Apr 26, 2013
Latest reply on Apr 29, 2013 by trademak
Has anyone seen the following error when claiming tasks?

<blockcode>
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`cqms_bpm`.`ACT_RU_IDENTITYLINK`, CONSTRAINT `ACT_FK_IDL_PROCINST` FOREIGN KEY (`PROC_INST_ID_`) REFERENCES `ACT_RU_EXECUTION` (`ID_`))
### The error may involve org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.insertIdentityLink-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_)     values (?,             1,             ?,             ?,             ?,             ?,             ?,             ?)
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`cqms_bpm`.`ACT_RU_IDENTITYLINK`, CONSTRAINT `ACT_FK_IDL_PROCINST` FOREIGN KEY (`PROC_INST_ID_`) REFERENCES `ACT_RU_EXECUTION` (`ID_`))""
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`cqms_bpm`.`ACT_RU_IDENTITYLINK`, CONSTRAINT `ACT_FK_IDL_PROCINST` FOREIGN KEY (`PROC_INST_ID_`) REFERENCES `ACT_RU_EXECUTION` (`ID_`))
### The error may involve org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.insertIdentityLink-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_)     values (?,             1,             ?,             ?,             ?,             ?,             ?,             ?)
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`cqms_bpm`.`ACT_RU_IDENTITYLINK`, CONSTRAINT `ACT_FK_IDL_PROCINST` FOREIGN KEY (`PROC_INST_ID_`) REFERENCES `ACT_RU_EXECUTION` (`ID_`))
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147) ~[mybatis-3.1.1.jar:3.1.1]
   at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134) ~[mybatis-3.1.1.jar:3.1.1]
   at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:633) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:460) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:168) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:115) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:70) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) ~[activiti-spring-5.12-WSM-01.jar:na]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) ~[spring-tx-3.2.2.RELEASE.jar:3.2.2.RELEASE]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) ~[activiti-spring-5.12-WSM-01.jar:na]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
   at org.activiti.engine.impl.TaskServiceImpl.claim(TaskServiceImpl.java:157) ~[activiti-engine-5.12-WSM-01.jar:5.12-WSM-01]
</blockcode>

We have seen this in production a few times recently, but it's unclear what would have changed in our code to cause this.

Any help appreciated!

– Michael

Outcomes