flowable / flowable/flowable-engine

Migration of process instance with parallel gateway in subprocess causes unexpected removal of task after migration

Open
#2,559 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

**Describe the bug**
I had a process definiton which contained a subprocess, and in the subprocess there were two tasks after a parallel gateway.

![bild](https://user-images.githubusercontent.com/592501/91183428-c2e96480-e6eb-11ea-92ec-aa3a297feefb.png)

with the following BPMN:

```




















```

I had then created a new version of the same process definiton which had simply changed the task2 taskDefinitonKey to task3.
The new BPMN is:

```




















```
I then wanted to migrate the process instances from the first version to the second version, with a mapping of activityId `task2` -> `task3`.
This was done with the following code:

```
processMigrationService.createProcessInstanceMigrationBuilder()
.migrateToProcessDefinition(processDefinitions.get(1).getId())
.addActivityMigrationMapping(ActivityMigrationMapping.createMappingFor("task2", "task3"))
.migrate(processInstance.getId());
```

After the migration had been run there was no `task2` or `task3` on the process instance anymore. `task1` was however still present. There was also no execution associated with either `task2` or `task3`.
I note that this behaviour occurs when you have both a subprocess and a parallel gateway inside of it. If I remove either the subprocess or gateway the migration successfully migrates `task2` to `task3`.

**Expected behavior**
I would expect `task2` to have been migrated to `task3`

**Code**
I have verified this behaviour with a unit test (I originally saw the problem on a more complex BPMN diagram) and the code can be found here - https://github.com/paulstapleton/testcases/blob/master/src/test/java/testcases/MigrationOfSubProcessAndParallelGatewayTest.java

The output from the unit test is that before migration we have:

```
15:50:08.579 [main] INFO t.MigrationOfSubProcessAndParallelGatewayTest - Before tasks: [Task[id=21, name=Task 1], Task[id=23, name=Task 2]]
15:50:08.591 [main] INFO t.MigrationOfSubProcessAndParallelGatewayTest - Before executions: [Scoped execution[ id '11' ] - activity 'sid-0453C91A-B59C-44BF-8EEB-FBEC090F9C96' - parent '7', Execution[ id '13' ] - activity 'task1' - parent '11', Execution[ id '17' ] - activity 'task2' - parent '11', ProcessInstance[7]]
```
and after migration we have:

```
15:50:08.697 [main] INFO t.MigrationOfSubProcessAndParallelGatewayTest - After tasks: [Task[id=21, name=Task 1]]
15:50:08.699 [main] INFO t.MigrationOfSubProcessAndParallelGatewayTest - After executions: [Execution[ id '13' ] - activity 'task1' - parent '24', Scoped execution[ id '24' ] - activity 'sid-0453C91A-B59C-44BF-8EEB-FBEC090F9C96' - parent '7', ProcessInstance[7]]
```

Where `task3` is clearly missing.

**Additional context**
This was tested in the latest flowable 6.6.0-SNAPSHOT using the h2 database.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.