When Task1 is completed in the following process diagram, referential integrity constraint violation error occurs.

### 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: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "ACT_FK_TASK_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) ('1656')"
Referential integrity constraint violation: "ACT_FK_TASK_EXE: PUBLIC.ACT_RU_TASK FOREIGN KEY(EXECUTION_ID_) REFERENCES PUBLIC.ACT_RU_EXECUTION(ID_) ('1656')"; SQL statement:
delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? [23503-176]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:185)
at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:293)
at org.activiti.engine.impl.db.DbSqlSession.flushRegularDeletes(DbSqlSession.java:897)
at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:890)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:617)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:178)
So, the record of the asynchronous user task still refer to the forked execution. Referential integrity constraint violation error occurs.
It is not the same cause, but related to the fix of the following pull request.
https://github.com/Activiti/Activiti/pull/1612
@daisuke-yoshimoto does the fix in #1612 fix this one as well?
@balsarori
I'm sorry for being confused.
No, this bug event will not be fixed by fixing the pull request.
However, it is a related bug.
Both bugs are related to replacing executionId in the timing that the forked execution is removed.
I'm still thinking about how to fix this bug.
Most helpful comment
@daisuke-yoshimoto does the fix in #1612 fix this one as well?