Unable to complete user task coming from parallel gateway

Description

I came across an issue while completing simple user task from the parallel gateway that contains a task with task listener.

Here are the steps to repro:

1. Create a TaskListener implementation that sets local variable on task creation
[code]private Expression expression;

public void notify(DelegateTask delegateTask) {
String expression = this.expression.getValue(delegateTask).toString();
delegateTask.setVariableLocal("validationRule", expression);

}/code
2. In bpmn xml file, create a parallel gateway with 2 outgoing tasks: a simple user task and a user task with task listener created in step 1
3. Deploy process definition
4. Run the process
5. Attempt to complete the simple user task programmatically
[code]TaskService taskService = getProcessEngine().getTaskService();
taskService.complete(taskId);
/code
6. Get the following stack trace:
[code]### Error updating database. Cause: java.sql.SQLException: The DELETE statement conflicted with the REFERENCE constraint "AC
T_FK_VAR_EXE". The conflict occurred in database "xxx", table "dbo.ACT_RU_VARIABLE", column 'EXECUTION_ID_'.

  1.  

    1.  

      1. The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution-Inline

      2. The error occurred while setting parameters

      3. Cause: java.sql.SQLException: The DELETE statement conflicted with the REFERENCE constraint "ACT_FK_VAR_EXE". The conflic
        t occurred in database "xxx", table "dbo.ACT_RU_VARIABLE", column 'EXECUTION_ID_'.
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:120)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:131)
        at org.activiti.engine.impl.db.DbSqlSession$DeleteById.execute(DbSqlSession.java:146)
        at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:444)
        at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:349)
        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147)
        at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:144)/code

Environment

SQL Server 2000

Assignee

saeid mirzaei

Reporter

Marina

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure