flowable / flowable/flowable-engine
Migration of process instance with parallel gateway in subprocess causes unexpected removal of task after migration
- Lingua principale
- Java
- Stelle
- 9.5k
- Fork
- 2.9k
- Merge medio
- 7h 8m
- PR unite (30g)
- 2
Descrizione
**Describe the bug**
I had a process definiton which contained a subprocess, and in the subprocess there were two tasks after a parallel gateway.

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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con il test di regressione fornito, MigrationOfSubProcessAndParallelGatewayTest.java, ed eseguilo con la configurazione H2 descritta nell’issue. Traccia il punto di ingresso della migrazione processMigrationService con il sottoprocesso, il gateway parallelo e la mappatura da task2 a task3. È completato quando l’istanza migrata conserva task1 e contiene task3, con la relativa esecuzione presente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 42/100