[BUG] Parallel Gateway with Multi-Instance Task Generates Duplicate Tasks When Moving Executions to External Activity

Author: sscfaithCreated May 14, 2025Updated May 25, 2026
  • Description Parallel Gateway with Multi-Instance Task Generates Duplicate Tasks When Moving Executions to External Activity. Flowable v6.8.0 is ok.

  • Version Flowable Version: 7.1.0

  • Unit Test

test.bpmn20.zip

java
@Test
@Deployment(resources = { "org/flowable/engine/test/api/test.bpmn20.xml" })
public void test() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("test");
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertThat(task.getTaskDefinitionKey()).isEqualTo("Starter");

    // Complete task Starter
    taskService.complete(task.getId());

    // Current Tasks
    List<String> currentActivities = new ArrayList<>();
    currentActivities.add("TaskA");
    currentActivities.add("TaskB");

    changeStateEventListener.clear();

    runtimeService.createChangeActivityStateBuilder()
            .processInstanceId(processInstance.getId())
            .moveActivityIdsToSingleActivityId(currentActivities, "Starter")
            .changeState();

    List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
    assertThat(tasks).hasSize(1);
}

Source: flowable/flowable-engine