Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-5120

Execution-End-Listener is invoked twice inside parallel multi instance

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.5.0, 7.4.2, 7.5.0-alpha1
    • Component/s: engine
    • Labels:

      Description

      Pre-condition:
      Deploy a process with a parallel multi instance sub process. This sub process contains a task with a execution-end-listener:

      <subProcess id="messageSubprocessLoop">
      
        <multiInstanceLoopCharacteristics>
          <loopCardinality xsi:type="tFormalExpression">2</loopCardinality>
        </multiInstanceLoopCharacteristics>
      
        <startEvent id="StartEvent_1" />
      
        <sequenceFlow sourceRef="StartEvent_1" targetRef="task" />
      
        <receiveTask id="task" messageRef="Message_1">
          <extensionElements>
            <camunda:executionListener class="org.my.company.MyListener" event="end"/>
          </extensionElements>
        </receiveTask>
      
        <sequenceFlow sourceRef="task" targetRef="EndEvent_1"/>
      
        <endEvent id="EndEvent_1" />
      
      </subProcess>
      

      Start an instance of the process, so that there are two tasks: receiveTask1 and receiveTask2. And there are two threads t1 and t2. t1 correlates a message against receiveTask1 and t2 correlates a message against receiveTask2 in parallel.

      Problem:
      1) Both threads t1 and t2 fetch the current execution tree.
      2) t1 signals receiveTask1 -> execution-end-listener is invoked
      3) t2 signals receiveTask2 -> execution-end-listener is invoked
      4) t1 executes end event inside parallel multi instance sub process
      5) t2 executes end event inside parallel multi instance sub process
      6) t1 calls ParallelMultiInstanceActivityBehavior#concurrentChildExecutionEnded()
      – the variable nrOfActiveInstances is set to 1
      7) t1 flushes and commits its changes
      8) t2 calls ParallelMultiInstanceActivityBehavior#concurrentChildExecutionEnded()
      – fetch the variable nrOfActiveInstances (value is 1)
      – decrement nrOfActiveInstances (value is 0)
      – for each concurrent child execution deleteCascade is invoked -> execution-end-listener of receiveTask1 is invoked

      Expected behavior:
      The execution-end-listener of receiveTask1 is not invoked in step 8.

        Attachments

          Activity

            People

            Assignee:
            thorben.lindhauer Thorben Lindhauer
            Reporter:
            roman.smirnov Smirnov Roman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: