Async Parallel HTTP Tasks Hangs

Hello,

I am trying to call an http api in parallel and measure its parallel execution.

I have marked 3 http tasks as async=true and the last parallel join as async=true exclusive=true
but when I run it seems that http tasks are hanging. Can someone bring some light? I am sure I am missing someting.

Thanks in advance,

bpmxml:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2">
  <process id="testparallel" name="testparallel" isExecutable="true">
    <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
    <scriptTask id="sid-0E97B271-8256-444F-BEA0-D3A27FC718A8" scriptFormat="JavaScript" flowable:autoStoreVariables="false">
      <script><![CDATA[print("=======START======");
var start = new Date().getTime();

execution.setVariable("start",start);]]></script>
    </scriptTask>
    <sequenceFlow id="sid-1FA28B75-3D24-4050-AEFF-3ACCA7199AD1" sourceRef="startEvent1" targetRef="sid-0E97B271-8256-444F-BEA0-D3A27FC718A8"></sequenceFlow>
    <parallelGateway id="sid-5C799377-7E3E-489D-96F3-2320E62F0260"></parallelGateway>
    <sequenceFlow id="sid-71C9E7BC-8330-4785-9080-29C8E332F047" sourceRef="sid-0E97B271-8256-444F-BEA0-D3A27FC718A8" targetRef="sid-5C799377-7E3E-489D-96F3-2320E62F0260"></sequenceFlow>
    <serviceTask id="http2" name="http2" flowable:async="true" flowable:exclusive="false" flowable:parallelInSameTransaction="true" flowable:type="http">
      <extensionElements>
        <flowable:field name="requestMethod">
          <flowable:string><![CDATA[GET]]></flowable:string>
        </flowable:field>
        <flowable:field name="requestUrl">
          <flowable:string><![CDATA[https://httpbin.org/delay/4]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>
    <parallelGateway id="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8" flowable:async="true"></parallelGateway>
    <sequenceFlow id="sid-8E6B782C-404F-47E4-9F92-7E0954813597" sourceRef="http2" targetRef="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8"></sequenceFlow>
    <endEvent id="sid-7F519047-05DA-429A-ABC2-97ED572DB959"></endEvent>
    <scriptTask id="sid-D4195ACF-1D95-4294-B369-3764EA3AF1F2" scriptFormat="JavaScript" flowable:autoStoreVariables="false">
      <script><![CDATA[print("=======END======");

var start = execution.getVariable("start");
var end = new Date().getTime();
var time = end - start;
print('Execution time: ' + time);]]></script>
    </scriptTask>
    <sequenceFlow id="sid-DC0792B1-A23E-4D3E-BBD4-268ED8B300B8" sourceRef="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8" targetRef="sid-D4195ACF-1D95-4294-B369-3764EA3AF1F2"></sequenceFlow>
    <sequenceFlow id="sid-BC0C2914-3359-4896-82C8-408F563407CF" sourceRef="sid-D4195ACF-1D95-4294-B369-3764EA3AF1F2" targetRef="sid-7F519047-05DA-429A-ABC2-97ED572DB959"></sequenceFlow>
    <serviceTask id="http1" name="http1" flowable:async="true" flowable:exclusive="false" flowable:parallelInSameTransaction="true" flowable:type="http">
      <extensionElements>
        <flowable:field name="requestMethod">
          <flowable:string><![CDATA[GET]]></flowable:string>
        </flowable:field>
        <flowable:field name="requestUrl">
          <flowable:string><![CDATA[https://httpbin.org/delay/4]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>
    <serviceTask id="http3" name="http3" flowable:async="true" flowable:exclusive="false" flowable:parallelInSameTransaction="true" flowable:type="http">
      <extensionElements>
        <flowable:field name="requestMethod">
          <flowable:string><![CDATA[GET]]></flowable:string>
        </flowable:field>
        <flowable:field name="requestUrl">
          <flowable:string><![CDATA[https://httpbin.org/delay/4]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="sid-1A5A7C90-297C-4525-8D12-F2903D796EBA" sourceRef="sid-5C799377-7E3E-489D-96F3-2320E62F0260" targetRef="http2"></sequenceFlow>
    <sequenceFlow id="sid-98C7A4C8-386E-4B4E-9053-7E7958DF8E66" sourceRef="sid-5C799377-7E3E-489D-96F3-2320E62F0260" targetRef="http1"></sequenceFlow>
    <sequenceFlow id="sid-DBBF6AC3-60CB-47CF-94BE-441CEB28B406" sourceRef="http1" targetRef="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8"></sequenceFlow>
    <sequenceFlow id="sid-B1F4C1CF-3A75-48A6-9FC1-B584E7605C99" sourceRef="sid-5C799377-7E3E-489D-96F3-2320E62F0260" targetRef="http3"></sequenceFlow>
    <sequenceFlow id="sid-1FB694A1-F97F-4885-B9C8-1B08F20E1B7C" sourceRef="http3" targetRef="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_testparallel">
    <bpmndi:BPMNPlane bpmnElement="testparallel" id="BPMNPlane_testparallel">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-0E97B271-8256-444F-BEA0-D3A27FC718A8" id="BPMNShape_sid-0E97B271-8256-444F-BEA0-D3A27FC718A8">
        <omgdc:Bounds height="80.0" width="100.0" x="225.0" y="138.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-5C799377-7E3E-489D-96F3-2320E62F0260" id="BPMNShape_sid-5C799377-7E3E-489D-96F3-2320E62F0260">
        <omgdc:Bounds height="40.0" width="40.0" x="420.0" y="159.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="http2" id="BPMNShape_http2">
        <omgdc:Bounds height="80.0" width="100.0" x="585.0" y="135.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8" id="BPMNShape_sid-8C11A077-C2CB-47DE-8171-630DF63CC5C8">
        <omgdc:Bounds height="40.0" width="40.0" x="780.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-7F519047-05DA-429A-ABC2-97ED572DB959" id="BPMNShape_sid-7F519047-05DA-429A-ABC2-97ED572DB959">
        <omgdc:Bounds height="28.0" width="28.0" x="1065.0" y="164.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-D4195ACF-1D95-4294-B369-3764EA3AF1F2" id="BPMNShape_sid-D4195ACF-1D95-4294-B369-3764EA3AF1F2">
        <omgdc:Bounds height="80.0" width="100.0" x="930.0" y="139.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="http1" id="BPMNShape_http1">
        <omgdc:Bounds height="80.0" width="100.0" x="585.0" y="30.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="http3" id="BPMNShape_http3">
        <omgdc:Bounds height="80.0" width="100.0" x="585.0" y="255.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-98C7A4C8-386E-4B4E-9053-7E7958DF8E66" id="BPMNEdge_sid-98C7A4C8-386E-4B4E-9053-7E7958DF8E66" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
        <omgdi:waypoint x="453.26406249999997" y="172.29605263157896"></omgdi:waypoint>
        <omgdi:waypoint x="585.0" y="98.12095115681235"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1FA28B75-3D24-4050-AEFF-3ACCA7199AD1" id="BPMNEdge_sid-1FA28B75-3D24-4050-AEFF-3ACCA7199AD1" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
        <omgdi:waypoint x="129.94999928606217" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="224.99999999995185" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-DBBF6AC3-60CB-47CF-94BE-441CEB28B406" id="BPMNEdge_sid-DBBF6AC3-60CB-47CF-94BE-441CEB28B406" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="20.0" flowable:targetDockerY="20.0">
        <omgdi:waypoint x="684.9499999999999" y="109.3545454545454"></omgdi:waypoint>
        <omgdi:waypoint x="788.8080311758725" y="191.1864406779661"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-8E6B782C-404F-47E4-9F92-7E0954813597" id="BPMNEdge_sid-8E6B782C-404F-47E4-9F92-7E0954813597" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="20.0" flowable:targetDockerY="20.0">
        <omgdi:waypoint x="684.9499999999999" y="175.0"></omgdi:waypoint>
        <omgdi:waypoint x="732.5" y="175.0"></omgdi:waypoint>
        <omgdi:waypoint x="732.5" y="200.0"></omgdi:waypoint>
        <omgdi:waypoint x="780.0" y="200.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-71C9E7BC-8330-4785-9080-29C8E332F047" id="BPMNEdge_sid-71C9E7BC-8330-4785-9080-29C8E332F047" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="20.0" flowable:targetDockerY="20.0">
        <omgdi:waypoint x="324.94999999993325" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="372.5" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="372.5" y="179.0"></omgdi:waypoint>
        <omgdi:waypoint x="420.0" y="179.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-DC0792B1-A23E-4D3E-BBD4-268ED8B300B8" id="BPMNEdge_sid-DC0792B1-A23E-4D3E-BBD4-268ED8B300B8" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
        <omgdi:waypoint x="819.4372989276138" y="200.5"></omgdi:waypoint>
        <omgdi:waypoint x="875.0" y="200.5"></omgdi:waypoint>
        <omgdi:waypoint x="875.0" y="179.0"></omgdi:waypoint>
        <omgdi:waypoint x="930.0" y="179.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1A5A7C90-297C-4525-8D12-F2903D796EBA" id="BPMNEdge_sid-1A5A7C90-297C-4525-8D12-F2903D796EBA" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
        <omgdi:waypoint x="459.4372989276139" y="179.5"></omgdi:waypoint>
        <omgdi:waypoint x="515.0" y="179.5"></omgdi:waypoint>
        <omgdi:waypoint x="515.0" y="175.0"></omgdi:waypoint>
        <omgdi:waypoint x="585.0" y="175.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-B1F4C1CF-3A75-48A6-9FC1-B584E7605C99" id="BPMNEdge_sid-B1F4C1CF-3A75-48A6-9FC1-B584E7605C99" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
        <omgdi:waypoint x="452.388818123186" y="186.56040322580645"></omgdi:waypoint>
        <omgdi:waypoint x="585.0" y="265.3084832904884"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1FB694A1-F97F-4885-B9C8-1B08F20E1B7C" id="BPMNEdge_sid-1FB694A1-F97F-4885-B9C8-1B08F20E1B7C" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="20.0" flowable:targetDockerY="20.0">
        <omgdi:waypoint x="684.9499999999999" y="266.2121212121212"></omgdi:waypoint>
        <omgdi:waypoint x="787.3076923076923" y="207.2894230769231"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-BC0C2914-3359-4896-82C8-408F563407CF" id="BPMNEdge_sid-BC0C2914-3359-4896-82C8-408F563407CF" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
        <omgdi:waypoint x="1029.95" y="178.49494949494948"></omgdi:waypoint>
        <omgdi:waypoint x="1065.000696868149" y="178.14090211353636"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Can you explain what you mean with hanging?

With async=true, I assume there is optimistic locking exceptions happening at the join, and you should see this in the logs.

Have a look at True Parallel Service Task Execution with Flowable for a better solution for this problem.