Bug 1328592 - [GSS](6.3.z)Duplicated process instances running a process with a multi-instance sub-process
Summary: [GSS](6.3.z)Duplicated process instances running a process with a multi-insta...
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: 1327850 1328595
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-19 19:28 UTC by Alessandro Lazarotti
Modified: 2020-03-27 20:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1327850
Environment:
Last Closed: 2020-03-27 20:07:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alessandro Lazarotti 2016-04-19 19:28:31 UTC
+++ This bug was initially created as a clone of Bug #1327850 +++

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.

--- Additional comment from Oscar Molina on 2016-04-16 17:23 EDT ---



--- Additional comment from JBoss Product and Program Management on 2016-04-16 17:30:08 EDT ---

Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Maciej Swiderski on 2016-04-18 12:58:51 EDT ---

this has already been fixed in 6.3 product

commit references in case it needs to be back ported
jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/2e5d454790ad0feea4ebf402435dcf8302f8a108
https://github.com/droolsjbpm/jbpm/commit/39a12a5686c9826d04f92c2d904664db9056515a

6.4.x:
https://github.com/droolsjbpm/jbpm/commit/a17c9f3d588ae6eab0c27e04da7654e5cbc44e3e
https://github.com/droolsjbpm/jbpm/commit/bf850924c3b802ea66868c7be8380a1592fad43d

setting to modified

--- Additional comment from ania on 2016-04-19 05:16:36 EDT ---

 === In Red Hat Customer Portal Case 01604093 ===
--- Comment by Honess, Ania on 19/04/2016 11:15 ---

-- srm update

Maciej 

Good feedback on the BZ status. If i understand correctly this is already known and resolved, correct? 

As the customer is using a new and pre-production installation shall we consult if they can download / upgrade directly to the version where is it already fixed and available? Lets explore this option so we can provide the fast solution.  

For GSS team - it would be really great to test 6.3 (or maybe it was already tested) and deliver?

Many thanks and regards

Ania

--- Additional comment from Maciej Swiderski on 2016-04-19 05:25:28 EDT ---

yes, it is fixed, I tested it based on steps described here and all worked fine - tested on Postgres

Decision about version that should be shipped to customer I leave to GSS


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