Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminate end event does not terminate process when waiting at parallel gateway #10590

Closed
remcowesterhoud opened this issue Sep 30, 2022 · 1 comment · Fixed by #10789
Closed
Assignees
Labels
area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/mid Marks a bug as having a noticeable impact but with a known workaround version:8.1.3 Marks an issue as being completely or in parts released in 8.1.3 version:8.2.0-alpha2 Marks an issue as being completely or in parts released in 8.2.0-alpha2 version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0

Comments

@remcowesterhoud
Copy link
Contributor

Describe the bug

When a process instance is waiting at a parallel gateway to resume, and while waiting a terminate end event is triggered the process instance does not get completed as expected.

image

To Reproduce

Unit test
  @Test
  public void repro() throws InterruptedException {
    ENGINE_RULE
        .deployment()
        .withXmlResource(
            Bpmn.createExecutableProcess(PROCESS_ID)
                .startEvent()
                .parallelGateway("fork")
                .parallelGateway("join")
                .moveToNode("fork")
                .serviceTask("A", s -> s.zeebeJobType("type"))
                .boundaryEvent()
                .error("code")
                .endEvent()
                .terminate()
                .moveToNode("A")
                .connectTo("join")
                .endEvent()
                .done())
        .deploy();

    final long processInstanceKey =
        ENGINE_RULE.processInstance().ofBpmnProcessId(PROCESS_ID).create();

    ENGINE_RULE
        .job()
        .ofInstance(processInstanceKey)
        .withType("type")
        .withErrorCode("code")
        .throwError();

    Assertions.assertThat(
            RecordingExporter.processInstanceRecords()
                .withProcessInstanceKey(processInstanceKey)
                .limitToProcessInstanceCompleted())
        .extracting(record -> record.getValue().getBpmnElementType(), Record::getIntent)
        .describedAs(
            "Expect to terminate all element instances when reaching the terminate end event")
        .containsSubsequence(
            tuple(BpmnElementType.END_EVENT, ProcessInstanceIntent.ELEMENT_COMPLETED),
            tuple(BpmnElementType.PROCESS, ProcessInstanceIntent.ELEMENT_COMPLETED));
  }

Expected behavior

Log/Stacktrace

Full Stacktrace

17:11:13.069 [] INFO  io.camunda.zeebe.test - Test failed, following records were exported:
17:11:13.072 [] INFO  io.camunda.zeebe.test - Compact log representation:
--------
	['C'ommand/'E'event/'R'ejection] [valueType] [intent] - #[position]->#[source record position] K[key] - [summary of value]
	P9K999 - key; #999 - record position; "ID" element/process id; @"elementid"/[P9K999] - element with ID and key
	Keys are decomposed into partition id and per partition key (e.g. 2251799813685253 -> P1K005). If single partition, the partition is omitted.
	Long IDs are shortened (e.g. 'startEvent_5d56488e-0570-416c-ba2d-36d2a3acea78' -> 'star..acea78'
--------
C DPLY      CREATE            - #01-> -1  -1 - 
E PROC      CREATED           - #02->#01 K01 - process.xml -> "process" (version:1)
E DPLY      CREATED           - #03->#01 K02 - process.xml
E DPLY      FULLY_DISTRIBUTED - #04->#01 K02 - 
C CREA      CREATE            - #05-> -1  -1 - new <process "process"> (default start)  (no vars)
C PI        ACTIVATE          - #06->#05 K03 - PROCESS "process" in <process "process"[K03]>
E CREA      CREATED           - #07->#05 K04 - new <process "process"> (default start)  (no vars)
E PI        ACTIVATING        - #08->#06 K03 - PROCESS "process" in <process "process"[K03]>
E PI        ACTIVATED         - #09->#06 K03 - PROCESS "process" in <process "process"[K03]>
C PI        ACTIVATE          - #10->#06  -1 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
E PI        ACTIVATING        - #11->#10 K05 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
E PI        ACTIVATED         - #12->#10 K05 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
C PI        COMPLETE          - #13->#10 K05 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
E PI        COMPLETING        - #14->#13 K05 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
E PI        COMPLETED         - #15->#13 K05 - START_EVENT "startEv..fdb156b" in <process "process"[K03]>
E PI        SEQ_FLOW_TAKEN    - #16->#13 K06 - SEQUENCE_FLOW "sequenc..c7b9483" in <process "process"[K03]>
C PI        ACTIVATE          - #17->#13 K07 - PARALLEL_GATEWAY "fork" in <process "process"[K03]>
E PI        ACTIVATING        - #18->#17 K07 - PARALLEL_GATEWAY "fork" in <process "process"[K03]>
E PI        ACTIVATED         - #19->#17 K07 - PARALLEL_GATEWAY "fork" in <process "process"[K03]>
E PI        COMPLETING        - #20->#17 K07 - PARALLEL_GATEWAY "fork" in <process "process"[K03]>
E PI        COMPLETED         - #21->#17 K07 - PARALLEL_GATEWAY "fork" in <process "process"[K03]>
E PI        SEQ_FLOW_TAKEN    - #22->#17 K08 - SEQUENCE_FLOW "sequenc..c93b4fd" in <process "process"[K03]>
C PI        ACTIVATE          - #23->#17 K09 - SERVICE_TASK "A" in <process "process"[K03]>
E PI        SEQ_FLOW_TAKEN    - #24->#17 K10 - SEQUENCE_FLOW "sequenc..3a8cf39" in <process "process"[K03]>
C PI        ACTIVATE          - #25->#17 K11 - PARALLEL_GATEWAY "join" in <process "process"[K03]>
E PI        ACTIVATING        - #26->#23 K09 - SERVICE_TASK "A" in <process "process"[K03]>
E JOB       CREATED           - #27->#23 K12 - K12 "type" @"A"[K09] 3 retries, in <process "process"[K03]> (no vars)
E PI        ACTIVATED         - #28->#23 K09 - SERVICE_TASK "A" in <process "process"[K03]>
C JOB       THROW_ERROR       - #29-> -1 K12 - K12 "type" @""[ -1] -1 retries, code: in <process ?[?]> (no vars)
R PI        ACTIVATE          - #30->#25 K11 - PARALLEL_GATEWAY "join" in <process "process"[K03]> !INVALID_STATE (Expected to be able to activate parallel gateway 'join', but not all sequence flows have been taken.)
E JOB       ERROR_THROWN      - #31->#29 K12 - K12 "type" @"A"[K09] 3 retries, code: in <process "process"[K03]> (no vars)
E PROC_EVNT TRIGGERING        - #32->#29 K13 -  @"boundar..b1745c5"[K09] in <process K01[K03]> (no vars)
C PI        TERMINATE         - #33->#29 K09 - SERVICE_TASK "A" in <process "process"[K03]>
E PI        TERMINATING       - #34->#33 K09 - SERVICE_TASK "A" in <process "process"[K03]>
E PI        TERMINATED        - #35->#33 K09 - SERVICE_TASK "A" in <process "process"[K03]>
E PROC_EVNT TRIGGERED         - #36->#33 K13 -  @"boundar..b1745c5"[K09] in <process K01[K03]> (no vars)
E PI        ACTIVATING        - #37->#33 K14 - BOUNDARY_EVENT "boundar..b1745c5" in <process "process"[K03]>
E PI        ACTIVATED         - #38->#33 K14 - BOUNDARY_EVENT "boundar..b1745c5" in <process "process"[K03]>
C PI        COMPLETE          - #39->#33 K14 - BOUNDARY_EVENT "boundar..b1745c5" in <process "process"[K03]>
E PI        COMPLETING        - #40->#39 K14 - BOUNDARY_EVENT "boundar..b1745c5" in <process "process"[K03]>
E PI        COMPLETED         - #41->#39 K14 - BOUNDARY_EVENT "boundar..b1745c5" in <process "process"[K03]>
E PI        SEQ_FLOW_TAKEN    - #42->#39 K15 - SEQUENCE_FLOW "sequenc..db5d21a" in <process "process"[K03]>
C PI        ACTIVATE          - #43->#39 K16 - END_EVENT "endEven..4f2a534" in <process "process"[K03]>
E PI        ACTIVATING        - #44->#43 K16 - END_EVENT "endEven..4f2a534" in <process "process"[K03]>
E PI        ACTIVATED         - #45->#43 K16 - END_EVENT "endEven..4f2a534" in <process "process"[K03]>
E PI        COMPLETING        - #46->#43 K16 - END_EVENT "endEven..4f2a534" in <process "process"[K03]>
E PI        COMPLETED         - #47->#43 K16 - END_EVENT "endEven..4f2a534" in <process "process"[K03]>

-------------- Deployed Processes ----------------------
process.xml -> "process" (version:1)[K01] ------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:ns0="http://camunda.org/schema/zeebe/1.0" id="definitions_f17e06c8-0173-452e-af99-8c2914f42e63" targetNamespace="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
  <process id="process" isExecutable="true">
    <startEvent id="startEvent_d274e150-3950-45bd-b339-97ae0fdb156b">
      <outgoing>sequenceFlow_05fb0dce-5443-44d6-8205-0c6dfc7b9483</outgoing>
    </startEvent>
    <parallelGateway id="fork" name="fork">
      <incoming>sequenceFlow_05fb0dce-5443-44d6-8205-0c6dfc7b9483</incoming>
      <outgoing>sequenceFlow_aa94e515-a681-4153-8eb8-2ff533a8cf39</outgoing>
      <outgoing>sequenceFlow_46d7fbb8-3c21-4552-a5c0-6f33cc93b4fd</outgoing>
    </parallelGateway>
    <sequenceFlow id="sequenceFlow_05fb0dce-5443-44d6-8205-0c6dfc7b9483" sourceRef="startEvent_d274e150-3950-45bd-b339-97ae0fdb156b" targetRef="fork"/>
    <parallelGateway id="join" name="join">
      <incoming>sequenceFlow_aa94e515-a681-4153-8eb8-2ff533a8cf39</incoming>
      <incoming>sequenceFlow_24600b14-e6f6-458e-a88c-4d8e8c96f465</incoming>
      <outgoing>sequenceFlow_39381bb7-913c-4811-82bd-0bd611b0df83</outgoing>
    </parallelGateway>
    <sequenceFlow id="sequenceFlow_aa94e515-a681-4153-8eb8-2ff533a8cf39" sourceRef="fork" targetRef="join"/>
    <serviceTask id="A" name="A">
      <extensionElements>
        <ns0:taskDefinition type="type"/>
      </extensionElements>
      <incoming>sequenceFlow_46d7fbb8-3c21-4552-a5c0-6f33cc93b4fd</incoming>
      <outgoing>sequenceFlow_24600b14-e6f6-458e-a88c-4d8e8c96f465</outgoing>
    </serviceTask>
    <sequenceFlow id="sequenceFlow_46d7fbb8-3c21-4552-a5c0-6f33cc93b4fd" sourceRef="fork" targetRef="A"/>
    <boundaryEvent attachedToRef="A" id="boundaryEvent_fcf6318c-f499-495c-bc44-12781b1745c5">
      <outgoing>sequenceFlow_37a7d7a7-7960-4572-ba04-19568db5d21a</outgoing>
      <errorEventDefinition errorRef="error_868c7514-e9f4-4560-ba68-796e697c66e6" id="errorEventDefinition_b810e287-b194-4b03-90ed-3242b01f5c7b"/>
    </boundaryEvent>
    <endEvent id="endEvent_5fc73a7e-a619-44ba-8c07-11d624f2a534">
      <incoming>sequenceFlow_37a7d7a7-7960-4572-ba04-19568db5d21a</incoming>
      <terminateEventDefinition id="terminateEventDefinition_8fa409dc-c814-428f-8d60-0cbc3034ef22"/>
    </endEvent>
    <sequenceFlow id="sequenceFlow_37a7d7a7-7960-4572-ba04-19568db5d21a" sourceRef="boundaryEvent_fcf6318c-f499-495c-bc44-12781b1745c5" targetRef="endEvent_5fc73a7e-a619-44ba-8c07-11d624f2a534"/>
    <sequenceFlow id="sequenceFlow_24600b14-e6f6-458e-a88c-4d8e8c96f465" sourceRef="A" targetRef="join"/>
    <endEvent id="endEvent_f7bf42e0-3087-46d5-b7e3-e38b26c8cfb8">
      <incoming>sequenceFlow_39381bb7-913c-4811-82bd-0bd611b0df83</incoming>
    </endEvent>
    <sequenceFlow id="sequenceFlow_39381bb7-913c-4811-82bd-0bd611b0df83" sourceRef="join" targetRef="endEvent_f7bf42e0-3087-46d5-b7e3-e38b26c8cfb8"/>
  </process>
  <error errorCode="code" id="error_868c7514-e9f4-4560-ba68-796e697c66e6"/>
  <bpmndi:BPMNDiagram id="BPMNDiagram_e2083d90-7d3f-4d44-9c09-73891ecad0e8">
    <bpmndi:BPMNPlane bpmnElement="process" id="BPMNPlane_c30ea071-4fd8-46db-8702-c945688ef6c6">
      <bpmndi:BPMNShape bpmnElement="startEvent_d274e150-3950-45bd-b339-97ae0fdb156b" id="BPMNShape_6b08eaa0-1376-4aa3-8703-0a1a56e319b8">
        <dc:Bounds height="36.0" width="36.0" x="100.0" y="100.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="fork" id="BPMNShape_249128d3-d735-4e1e-a258-2f5cb61f1f04">
        <dc:Bounds height="50.0" width="50.0" x="186.0" y="93.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_05fb0dce-5443-44d6-8205-0c6dfc7b9483" id="BPMNEdge_1083f4cf-d27e-4bc5-8d9d-5334a0648d45">
        <di:waypoint x="136.0" y="118.0"/>
        <di:waypoint x="186.0" y="118.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape bpmnElement="join" id="BPMNShape_f3533641-ff47-446b-b5d8-b29813880124">
        <dc:Bounds height="50.0" width="50.0" x="286.0" y="93.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_aa94e515-a681-4153-8eb8-2ff533a8cf39" id="BPMNEdge_8c4f41aa-0565-45c8-9309-f30edef04eb4">
        <di:waypoint x="236.0" y="118.0"/>
        <di:waypoint x="286.0" y="118.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape bpmnElement="A" id="BPMNShape_e349a682-f2b6-4a64-ac11-6fe202632a1c">
        <dc:Bounds height="80.0" width="100.0" x="286.0" y="193.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_46d7fbb8-3c21-4552-a5c0-6f33cc93b4fd" id="BPMNEdge_95f51ba1-d6f4-4ccf-8a7f-fbb552d93294">
        <di:waypoint x="211.0" y="143.0"/>
        <di:waypoint x="211.0" y="233.0"/>
        <di:waypoint x="286.0" y="233.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape bpmnElement="boundaryEvent_fcf6318c-f499-495c-bc44-12781b1745c5" id="BPMNShape_ab1d210a-d2bf-494d-841c-b7777489b3f4">
        <dc:Bounds height="36.0" width="36.0" x="318.0" y="255.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endEvent_5fc73a7e-a619-44ba-8c07-11d624f2a534" id="BPMNShape_2606c215-3174-47a6-9701-f820c83c4d4e">
        <dc:Bounds height="36.0" width="36.0" x="366.5" y="323.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_37a7d7a7-7960-4572-ba04-19568db5d21a" id="BPMNEdge_e0bc9d4b-c304-41cb-8066-742b1531b6dd">
        <di:waypoint x="336.0" y="291.0"/>
        <di:waypoint x="336.0" y="341.0"/>
        <di:waypoint x="366.5" y="341.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_24600b14-e6f6-458e-a88c-4d8e8c96f465" id="BPMNEdge_67b5d2e4-d754-47cb-9d42-699147e7b986">
        <di:waypoint x="386.0" y="233.0"/>
        <di:waypoint x="286.0" y="118.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape bpmnElement="endEvent_f7bf42e0-3087-46d5-b7e3-e38b26c8cfb8" id="BPMNShape_79ab6d98-82f0-4114-897a-e830fdcf0bd5">
        <dc:Bounds height="36.0" width="36.0" x="386.0" y="100.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow_39381bb7-913c-4811-82bd-0bd611b0df83" id="BPMNEdge_3de770cf-f1e7-4eb4-ade9-856c85c07eba">
        <di:waypoint x="336.0" y="118.0"/>
        <di:waypoint x="386.0" y="118.0"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


--------------- Decomposed keys (for debugging) -----------------
 -1 <-> -1
K01 <-> 2251799813685249
K02 <-> 2251799813685250
K03 <-> 2251799813685251
K04 <-> 2251799813685252
K05 <-> 2251799813685253
K06 <-> 2251799813685254
K07 <-> 2251799813685255
K08 <-> 2251799813685256
K09 <-> 2251799813685257
K10 <-> 2251799813685258
K11 <-> 2251799813685259
K12 <-> 2251799813685260
K13 <-> 2251799813685261
K14 <-> 2251799813685262
K15 <-> 2251799813685263
K16 <-> 2251799813685264


java.lang.AssertionError: [Expect to terminate all element instances when reaching the terminate end event] 
Expecting actual to contain the specified subsequence but failed to find the element at subsequence index 1 in actual:
subsequence element not found in actual:
  (PROCESS, ELEMENT_COMPLETED)
actual:
  [(PROCESS, ACTIVATE_ELEMENT),
    (PROCESS, ELEMENT_ACTIVATING),
    (PROCESS, ELEMENT_ACTIVATED),
    (START_EVENT, ACTIVATE_ELEMENT),
    (START_EVENT, ELEMENT_ACTIVATING),
    (START_EVENT, ELEMENT_ACTIVATED),
    (START_EVENT, COMPLETE_ELEMENT),
    (START_EVENT, ELEMENT_COMPLETING),
    (START_EVENT, ELEMENT_COMPLETED),
    (SEQUENCE_FLOW, SEQUENCE_FLOW_TAKEN),
    (PARALLEL_GATEWAY, ACTIVATE_ELEMENT),
    (PARALLEL_GATEWAY, ELEMENT_ACTIVATING),
    (PARALLEL_GATEWAY, ELEMENT_ACTIVATED),
    (PARALLEL_GATEWAY, ELEMENT_COMPLETING),
    (PARALLEL_GATEWAY, ELEMENT_COMPLETED),
    (SEQUENCE_FLOW, SEQUENCE_FLOW_TAKEN),
    (SERVICE_TASK, ACTIVATE_ELEMENT),
    (SEQUENCE_FLOW, SEQUENCE_FLOW_TAKEN),
    (PARALLEL_GATEWAY, ACTIVATE_ELEMENT),
    (SERVICE_TASK, ELEMENT_ACTIVATING),
    (SERVICE_TASK, ELEMENT_ACTIVATED),
    (PARALLEL_GATEWAY, ACTIVATE_ELEMENT),
    (SERVICE_TASK, TERMINATE_ELEMENT),
    (SERVICE_TASK, ELEMENT_TERMINATING),
    (SERVICE_TASK, ELEMENT_TERMINATED),
    (BOUNDARY_EVENT, ELEMENT_ACTIVATING),
    (BOUNDARY_EVENT, ELEMENT_ACTIVATED),
    (BOUNDARY_EVENT, COMPLETE_ELEMENT),
    (BOUNDARY_EVENT, ELEMENT_COMPLETING),
    (BOUNDARY_EVENT, ELEMENT_COMPLETED),
    (SEQUENCE_FLOW, SEQUENCE_FLOW_TAKEN),
    (END_EVENT, ACTIVATE_ELEMENT),
    (END_EVENT, ELEMENT_ACTIVATING),
    (END_EVENT, ELEMENT_ACTIVATED),
    (END_EVENT, ELEMENT_COMPLETING),
    (END_EVENT, ELEMENT_COMPLETED)]
subsequence:
  [(END_EVENT, ELEMENT_COMPLETED), (PROCESS, ELEMENT_COMPLETED)]

	at io.camunda.zeebe.engine.processing.bpmn.activity.TerminateEndEventTest.repro(TerminateEndEventTest.java:518)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Environment:

  • OS: local MacOS
  • Zeebe Version: latest main
@remcowesterhoud remcowesterhoud added kind/bug Categorizes an issue or PR as a bug severity/mid Marks a bug as having a noticeable impact but with a known workaround scope/broker Marks an issue or PR to appear in the broker section of the changelog area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) labels Sep 30, 2022
@remcowesterhoud remcowesterhoud self-assigned this Oct 21, 2022
@remcowesterhoud
Copy link
Contributor Author

The problem here is quite straightforward. The flow scope in which the end event exists still has one active sequence flow. Upon completing this end event we check if this is the end of the execution path. Since this is the case we will see if there is any active element instances or active sequence flows left. If that is not the case the flow scope will be completed. Since there is 1 active sequence flow the flow scope will not be completed.

zeebe-bors-camunda bot added a commit that referenced this issue Oct 26, 2022
10821: [Backport stable/8.1] Reset active sequence flows upon terminate end event activation r=remcowesterhoud a=backport-action

# Description
Backport of #10789 to `stable/8.1`.

relates to #10590

Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
@korthout korthout added the version:8.1.3 Marks an issue as being completely or in parts released in 8.1.3 label Nov 1, 2022
zeebe-bors-camunda bot added a commit that referenced this issue Nov 22, 2022
10595: Add terminate end event to randomised tests r=remcowesterhoud a=remcowesterhoud

## Description

<!-- Please explain the changes you made here. -->
This PR will generate processes containing terminate end events. When a terminate end event is reached the flow scope should be terminated (not that it writes a COMPLETED event for the flow scope itself). If this was the root flow scope the process is completed, otherwise processing will continue as expected.

At this moment this PR only adds terminate end events through boundary events on user tasks, job worker tasks, and sub processes. Just this allows the events to be present in different flow scopes of the process.

Since the randomised tests don't know the concept of flow scopes it's not straightforward to support terminate end events. Generating them is easy, however having to generate an execution path proofs difficult. What we do have is `ExecutionPathSegements`. An `ExecutionPathSegment` is a set of steps that completes a specific part of the process. To understand this PR it is required to know how the execution path generation works.


A randomly generated process consist of `BlockBuilders`. Each `BlockBuilder` is responsible for generating a part of the process. There is many different kinds of `BlockBuilders`, for example `UserTaskBlockBuilder` and `SubProcessBlockBuilder`. When we generate an execution path we will iterate over these `BlockBuilders` and each of them will generate it's own `ExecutionPathSegment`.
These `BlockBuilders` are nested. We always have a root `BlockSequenceBuilder`. Generating an execution path causes this root `BlockBuilder` to iterate over all the `BlockBuilders` nested within it. For each of these it will generate the execution path and append the execution steps of that segment to it's own `ExecutionPathSegment`. Of course generating the path for this nested block builder will result in the nested block builder generating that are nested within that block builder as well.
By doing this the root block builder will end up with an `ExecutionPathSegment` which contains all the execution steps for the entire process.

The tricky part for this PR is that we somehow need to stop appending new execution paths to the `ExecutionPathSegment` when we encounter a terminate end event. For this I've introduced a boolean on the `ExecutionPathSegment`. Because of this flag each `BlockBuilder` will have the freedom to decide what should happen when a terminate end event is reached. Some will prevent the appending of new segments (e.g. `ExclusiveGatewayBlockBuilder`), and some will allow appending new segments after the current (e.g. `SubProcessBlockBuilder`).



As mentioned I've only introduces the terminate end event connected to boundary events. The reasoning for this is that the randomised tests are already complex as-is. There is no straightforward way to have 1 branch of a gateway connect to a terminate end event. Since the boundary events already cover all scenarios I believe it is fine to limit it to this.

## Related issues

<!-- Which issues are closed by this PR or are related -->

blocked by #10590
closes #10476 



11067: docs(docker): hint on BuildKit being required r=megglos a=megglos

## Description

As found yesterday the recent changes to the Dockerfile introducing the TARGETARCH var require Docker BuildKit to be enabled.


Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
@remcowesterhoud remcowesterhoud added the version:8.2.0-alpha2 Marks an issue as being completely or in parts released in 8.2.0-alpha2 label Dec 6, 2022
@npepinpe npepinpe added the version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0 label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/reliability Marks an issue as related to improving the reliability of our software (i.e. it behaves as expected) kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/mid Marks a bug as having a noticeable impact but with a known workaround version:8.1.3 Marks an issue as being completely or in parts released in 8.1.3 version:8.2.0-alpha2 Marks an issue as being completely or in parts released in 8.2.0-alpha2 version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants