Multiple Event Sub-Process

Hello,

I define the following process definition with an embedded sub-process B in an embedded sub-process A.

When running this process the Event Sub-Process B catches the HTTP404 thrown by the HTTP task in Sub-Process A.

Why this ? I expected that the Event Sub-Process A catch the error.

Regards
Vincent

To help reproduce my usecase, I add the process definition

<?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="B11117" name="B11117" isExecutable="true">
    <subProcess id="subProcessA" name="SubProcess A" flowable:async="true">
      <subProcess triggeredByEvent="true" id="sid-a591b6fd-899f-4ecd-aa37-77de1cc279d3" flowable:exclusive="true" name="catch errors in subprocess A">
        <startEvent id="sid-1ca63fd5-28c2-4dbf-a99e-ab31c3cbeed8">
          <errorEventDefinition flowable:errorVariableName="error_code_A"/>
        </startEvent>
        <scriptTask id="sid-d5ab03e1-b27b-4b4c-9643-2916e4d46635" name="Add error to report" scriptFormat="groovy" flowable:autoStoreVariables="false">
          <script><![CDATA[println("Unexpected error in subProcessA: ${error_code_A}")]]></script>
        </scriptTask>
        <endEvent id="sid-1efa9ba7-a2b8-4830-b8b8-976ec85fab70"/>
        <sequenceFlow id="sid-09026633-a7d5-4b27-911c-e3d93f1d5a0d" sourceRef="sid-1ca63fd5-28c2-4dbf-a99e-ab31c3cbeed8" targetRef="sid-d5ab03e1-b27b-4b4c-9643-2916e4d46635"/>
        <sequenceFlow id="sid-9c0409e6-86fa-471a-a029-3d7734fdaf98" sourceRef="sid-d5ab03e1-b27b-4b4c-9643-2916e4d46635" targetRef="sid-1efa9ba7-a2b8-4830-b8b8-976ec85fab70"/>
      </subProcess>
      <startEvent id="subProcessAStart" flowable:formFieldValidation="true"/>
      <sequenceFlow id="sequenceFlow-29e5f336-b69a-4f17-a526-b82212a468b7" sourceRef="subProcessAStart" targetRef="http404A"/>
        <serviceTask id="http404A" name="A throw HTTP404" flowable:parallelInSameTransaction="true" flowable:type="http">
            <extensionElements>
                <flowable:field name="requestMethod">
                    <flowable:string><![CDATA[GET]]></flowable:string>
                </flowable:field>
                <flowable:field name="requestUrl">
                    <flowable:expression><![CDATA[http://host.docker.internal:1080/http404]]></flowable:expression>
                </flowable:field>
                <flowable:field name="handleStatusCodes">
                    <flowable:string><![CDATA[404]]></flowable:string>
                </flowable:field>
            </extensionElements>
        </serviceTask>
      <subProcess id="subProcessB" name="SubProcess B" flowable:async="true">
          <multiInstanceLoopCharacteristics isSequential="true" flowable:collection="${collection}" flowable:elementVariable="item">
              <extensionElements/>
          </multiInstanceLoopCharacteristics>
        <subProcess id="catchErrors" name="catch errors in subprocess B" triggeredByEvent="true">
          <startEvent id="startError">
              <errorEventDefinition flowable:errorVariableName="error_code_B"/>
          </startEvent>
          <sequenceFlow id="sequenceFlow-02f3d0b7-8641-42c9-9ead-15b03f294a81" sourceRef="startError" targetRef="addError"/>
          <scriptTask id="addError" name="Add error to report" scriptFormat="groovy" flowable:autoStoreVariables="false">
              <script><![CDATA[println("Unexpected error in subProcessB: ${error_code_B}")]]></script>
          </scriptTask>
          <sequenceFlow id="sequenceFlow-332a18b4-d49a-4d92-87c6-aa917c51ba63" sourceRef="addError" targetRef="endError"/>
          <endEvent id="endError"/>
        </subProcess>
        <startEvent id="subProcessBStart"/>
        <serviceTask flowable:type="http" id="http404B" name="B throw HTTP404" flowable:exclusive="true">
          <extensionElements>
            <flowable:field name="requestMethod">
              <flowable:string>GET</flowable:string>
            </flowable:field>
              <flowable:field name="requestUrl">
                  <flowable:expression><![CDATA[http://host.docker.internal:1080/http404]]></flowable:expression>
              </flowable:field>
              <flowable:field name="handleStatusCodes">
                  <flowable:string><![CDATA[404]]></flowable:string>
              </flowable:field>
          </extensionElements>
        </serviceTask>
        <sequenceFlow id="sid-98ed46cd-44be-4ccb-9a20-34641880011f" sourceRef="subProcessBStart" targetRef="http404B"/>
        <endEvent id="sid-96e8ded1-7022-4d6d-ae8a-b5630412d4fb"/>
        <sequenceFlow id="sid-c2274e3b-de8d-4d95-b05e-7408f13c1949" sourceRef="http404B" targetRef="sid-96e8ded1-7022-4d6d-ae8a-b5630412d4fb"/>
      </subProcess>
      <endEvent id="subProcessAEnd"/>
      <sequenceFlow id="sid-15edbcf3-5b68-47a1-932d-ddf5e5584c90" sourceRef="http404A" targetRef="subProcessB"/>
      <sequenceFlow id="sid-70ba29e8-022e-483c-bda0-a0240f619e7b" sourceRef="subProcessB" targetRef="subProcessAEnd"/>
    </subProcess>
    <startEvent id="sid-7766770f-9c11-4527-ae87-830057c1a1bf"/>
    <endEvent id="sid-707a62cd-5a11-45a6-a9d8-dcafe0bb9fa8"/>
    <sequenceFlow id="sid-1c6282c7-4baa-4147-a84b-75b87c1f42fb" sourceRef="sid-7766770f-9c11-4527-ae87-830057c1a1bf" targetRef="subProcessA"/>
    <sequenceFlow id="sid-06f41223-d13e-4649-a895-89421a135e47" sourceRef="subProcessA" targetRef="sid-707a62cd-5a11-45a6-a9d8-dcafe0bb9fa8"/>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_B11117">
    <bpmndi:BPMNPlane bpmnElement="B11117" id="BPMNPlane_B11117">
      <bpmndi:BPMNShape bpmnElement="subProcessA" id="BPMNShape_subProcessA">
        <omgdc:Bounds height="919.00006" width="1135.0" x="1220.0" y="100.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="subProcessAStart" id="BPMNShape_subProcessAStart">
        <omgdc:Bounds height="30.0" width="30.0" x="1240.0" y="453.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="http404A" id="BPMNShape_http404">
        <omgdc:Bounds height="315.0" width="195.0" x="1350.0" y="310.5"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="subProcessB" id="BPMNShape_subProcessB">
        <omgdc:Bounds height="409.0" width="565.0" x="1672.5" y="263.5"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="subProcessBStart" id="BPMNShape_subProcessBStart">
        <omgdc:Bounds height="30.0" width="30.0" x="1707.5" y="370.50003"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="catchErrors" id="BPMNShape_catchErrors">
        <omgdc:Bounds height="160.0" width="510.0" x="1700.0" y="468.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="startError" id="BPMNShape_startError">
        <omgdc:Bounds height="30.0" width="30.0" x="1780.0" y="558.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="addError" id="BPMNShape_addError">
        <omgdc:Bounds height="60.0" width="100.0" x="1860.0001" y="543.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endError" id="BPMNShape_endError">
        <omgdc:Bounds height="30.0" width="30.0" x="2010.0" y="558.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="subProcessAEnd" id="BPMNShape_subProcessAEnd">
        <omgdc:Bounds height="30.0" width="30.0" x="2300.0" y="453.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow-29e5f336-b69a-4f17-a526-b82212a468b7" id="BPMNEdge_sequenceFlow-29e5f336-b69a-4f17-a526-b82212a468b7" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="30.0">
        <omgdi:waypoint x="1269.95" y="468.0"/>
        <omgdi:waypoint x="1350.0" y="468.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow-332a18b4-d49a-4d92-87c6-aa917c51ba63" id="BPMNEdge_sequenceFlow-332a18b4-d49a-4d92-87c6-aa917c51ba63" flowable:sourceDockerX="50.0" flowable:sourceDockerY="30.0" flowable:targetDockerX="15.0" flowable:targetDockerY="15.0">
        <omgdi:waypoint x="1959.9501" y="573.0"/>
        <omgdi:waypoint x="1972.0" y="573.0"/>
        <omgdi:waypoint x="1972.0" y="573.0"/>
        <omgdi:waypoint x="2010.0" y="573.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow-02f3d0b7-8641-42c9-9ead-15b03f294a81" id="BPMNEdge_sequenceFlow-02f3d0b7-8641-42c9-9ead-15b03f294a81" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="30.0">
        <omgdi:waypoint x="1809.95" y="573.0"/>
        <omgdi:waypoint x="1822.0" y="573.0"/>
        <omgdi:waypoint x="1822.0" y="573.0"/>
        <omgdi:waypoint x="1860.0001" y="573.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-d83e8bb3-327c-4557-b1bc-939c83e0bef9" bpmnElement="sid-a591b6fd-899f-4ecd-aa37-77de1cc279d3">
        <omgdc:Bounds x="1508.7499" y="775.0" width="540.0" height="160.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-468d0b10-121b-42c3-8514-da26903d5147" bpmnElement="sid-1ca63fd5-28c2-4dbf-a99e-ab31c3cbeed8">
        <omgdc:Bounds x="1583.7499" y="860.0" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-b8078867-9032-48db-a2db-3464cc4397b6" bpmnElement="sid-d5ab03e1-b27b-4b4c-9643-2916e4d46635">
        <omgdc:Bounds x="1673.7499" y="835.0" width="100.0" height="80.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-4acd3075-9d69-4e68-863b-d2b0805c5918" bpmnElement="sid-1efa9ba7-a2b8-4830-b8b8-976ec85fab70">
        <omgdc:Bounds x="1858.7499" y="860.0" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-f6910cc1-d525-48c4-aa12-ebd2e4dca6a4" bpmnElement="sid-09026633-a7d5-4b27-911c-e3d93f1d5a0d">
        <omgdi:waypoint x="1613.7499" y="875.0"/>
        <omgdi:waypoint x="1673.7499" y="875.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-30e4fb01-0871-4c99-8790-ecc4e8ce58ca" bpmnElement="sid-9c0409e6-86fa-471a-a029-3d7734fdaf98">
        <omgdi:waypoint x="1773.7499" y="875.0"/>
        <omgdi:waypoint x="1858.7499" y="875.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="sid-4d0c87bb-e4e2-4162-86da-f30d6da5befe" bpmnElement="http404B">
        <omgdc:Bounds x="1853.9592" y="355.50006" width="100.0" height="60.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-192ae544-5f82-4167-871c-5f3a4ed472cc" bpmnElement="sid-15edbcf3-5b68-47a1-932d-ddf5e5584c90">
        <omgdi:waypoint x="1545.0" y="468.0"/>
        <omgdi:waypoint x="1672.5" y="468.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-00d850be-f4fd-4976-bb4f-8808ba083f2a" bpmnElement="sid-98ed46cd-44be-4ccb-9a20-34641880011f">
        <omgdi:waypoint x="1737.5" y="385.50003"/>
        <omgdi:waypoint x="1853.9592" y="385.50006"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-f7ce01a1-8166-4771-bb5b-31b749a8fdd2" bpmnElement="sid-96e8ded1-7022-4d6d-ae8a-b5630412d4fb">
        <omgdc:Bounds x="2097.5" y="370.50006" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-e1a901d1-b3fd-4a2d-bfd9-042e5e2ed987" bpmnElement="sid-c2274e3b-de8d-4d95-b05e-7408f13c1949">
        <omgdi:waypoint x="1953.9592" y="385.50006"/>
        <omgdi:waypoint x="2097.5" y="385.50006"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-47ef4d5e-9702-4ada-b4f7-d97d3cb78fae" bpmnElement="sid-70ba29e8-022e-483c-bda0-a0240f619e7b">
        <omgdi:waypoint x="2237.5" y="468.0"/>
        <omgdi:waypoint x="2300.0" y="468.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-8574abf3-2cc7-40a0-adb7-cdf8894a61a8" bpmnElement="sid-7766770f-9c11-4527-ae87-830057c1a1bf">
        <omgdc:Bounds x="1065.0" y="544.5" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-858bd1e5-36e1-48d8-8e85-5dfbd0686fea" bpmnElement="sid-707a62cd-5a11-45a6-a9d8-dcafe0bb9fa8">
        <omgdc:Bounds x="2455.0" y="544.5" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-4f5b89c6-9841-4ee1-9a05-85fd930ae76f" bpmnElement="sid-1c6282c7-4baa-4147-a84b-75b87c1f42fb">
        <omgdi:waypoint x="1095.0" y="559.5"/>
        <omgdi:waypoint x="1220.0" y="559.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-68fe6906-9df0-4d28-894c-7913f1429795" bpmnElement="sid-06f41223-d13e-4649-a895-89421a135e47">
        <omgdi:waypoint x="2355.0" y="559.5"/>
        <omgdi:waypoint x="2454.9998" y="559.5"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Another information, it’s randomly fail. Sometimes, event sub-process A is used, sometimes not.

Regards