Bug 1327850 - Duplicated process instances running a process with a multi-instance sub-process
Summary: Duplicated process instances running a process with a multi-instance sub-process
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: jBPM Core
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ER3
: ---
Assignee: Alessandro Lazarotti
QA Contact: Radovan Synek
URL:
Whiteboard:
Depends On:
Blocks: 1328592 1328595
TreeView+ depends on / blocked
 
Reported: 2016-04-16 21:22 UTC by Oscar Molina
Modified: 2020-03-27 20:06 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
: 1328592 1328595 (view as bug list)
Environment:
Last Closed: 2020-03-27 20:06:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Main process definition (20.71 KB, application/xml)
2016-04-16 21:22 UTC, Oscar Molina
no flags Details
Sub-process (4.13 KB, application/xml)
2016-04-16 21:23 UTC, Oscar Molina
no flags Details

Description Oscar Molina 2016-04-16 21:22:27 UTC
Created attachment 1148024 [details]
Main process definition

Description of problem:

We execute a flow with subprocesses as you can see in the attached file "proc_encendido_v1.bpmn2". When the execution process arrives to "Subproceso de encendido de dispositivo", it receives a list of "dispositivos" and by using each element of the list, it triggers a process. At the end of the execution we can see that in PROCESSINSTANCELOG table the subprocesses info appears twice. Moreover you can see duplicated process instances in the Process Instances list in the business-central.

Version-Release number of selected component (if applicable):

EAP 6.4.5 + BPMS 6.2 + PostgreSQL

How reproducible:

You must log on the business-central and create an empty project although you can use the default project created the first time you installed BPMS. Then you can import the processes attached to this ticket "proc_encendido_v1.bpmn2" and "task_encender_v1.bpmn2" and deploy the project as "PER_PROCESS_INSTANCE" strategy. Finally you can start the process from a java code using REST API.

Steps to Reproduce:
1. Install EAP 6.4.5 + BPMS 6.2 + PostgreSQL
2. Create a user "bpmsAdmin" with roles: admin,analyst,rest-all
3. Log on the business-central.
4. Create an empty project or use the default project created the first time you installed BPMS.
5. Import the processes attached to this ticket "proc_encendido_v1.bpmn2" and "task_encender_v1.bpmn2".
6. Deploy the project as "PER_PROCESS_INSTANCE" strategy.
7. Start the process from a java code as following:

~~~
package org.gss.jbpm;

import java.net.URL;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.remote.client.api.RemoteRuntimeEngineFactory;

public class RESTTriggerExample {

  /*
    Set the parameters according your installation
    org.kie.example:project1:1.0.0-SNAPSHOT
  */
  private static final String DEPLOYMENT_ID = "org.kie.example:project1:LATEST";
  private static final String APP_URL = "http://localhost:8080/business-central/";
  private static final String USER = "bpmsAdmin";
  private static final String PASSWORD = "admin@123";

  public static final void main(String[] args) {
    try {
      URL url = new URL(APP_URL);

      RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder().addUrl(url).addUserName(USER).addPassword(PASSWORD).addDeploymentId(DEPLOYMENT_ID).build();

      KieSession ksession = engine.getKieSession();

      System.out.println("Result: " + lanzarProceso(ksession));

    } catch (Throwable t) {
      t.printStackTrace();
    }
  }

  public static final String lanzarProceso(KieSession ksession) {

    String results = "OK";
    long centro = 2002;
    GregorianCalendar gcal = new GregorianCalendar();
    XMLGregorianCalendar hora_encendido = null;
    try {
      hora_encendido = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
    } catch (DatatypeConfigurationException e1) {
      e1.printStackTrace();
    }

    List<String> dispositivos = new ArrayList<String>();
    dispositivos.add("CAJ1.2002.SHOP");
    dispositivos.add("CAJ2.2002.SHOP");
    dispositivos.add("CAJ3.2002.SHOP");
    dispositivos.add("CAJ4.2002.SHOP");
    dispositivos.add("CAJ5.2002.SHOP");
    dispositivos.add("CAJ6.2002.SHOP");
    dispositivos.add("CAJ7.2002.SHOP");
    dispositivos.add("CAJ8.2002.SHOP");
    dispositivos.add("CAJ9.2002.SHOP");
    dispositivos.add("CAJ10.2002.SHOP");
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("codNCentro", centro);
    params.put("diario", false);
    params.put("horaEncendido", hora_encendido != null ? hora_encendido.toXMLFormat() : "");
    params.put("listadoDispositivos", dispositivos);
    params.put("aplicacion", "orquestarbpm");

    try {
      ksession.startProcess("org.gss.jbpm.procesos.encendidoV1", params);
    } catch (Throwable e) {
      e.printStackTrace();
      results = "KOOOOOOOO";
    }

    return results;
  }
	
}
~~~

Actual results:

21 instances in PROCESSINSTANCELOG table where the subprocesses info appears twice. 
21 process instances in the Process Instances list in the business-central with duplicated process instances. 

Expected results:

11 instances in PROCESSINSTANCELOG table. 
11 process instances in the Process Instances list in the business-central. 

Additional info:

These tests have been executed in PostgreSQL and Oracle.

Comment 1 Oscar Molina 2016-04-16 21:23:50 UTC
Created attachment 1148025 [details]
Sub-process


Note You need to log in before you can comment on or make changes to this bug.