01-29-2017 07:38 PM
We recently updated our Activiti version from 5.16.3 to 5.21, and we have found a scenario in one of our existing processes where a process will get stuck with no way to recover the process.
Basically if you have a parallel gateway, one of the branches has a service task that is asynchronous, and the other branch is not asynchronous and flows through to an end event straight away, the branch that is asynchronous will never have a job fired to process the async continuation and be stuck forever.
This is a sample process that illustrates the issue:
<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:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="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.activiti.org/test">
<process id="ParallelGatewayTest" name="My ParallelGatewayTest" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="servicetask1" name="Asynchronous Task" activiti:async="true" activiti:class="com.example.SomeListener"></serviceTask>
<parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="parallelgateway1"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="parallelgateway1" targetRef="servicetask1"></sequenceFlow>
<serviceTask id="shouldAlwaysRun" name="Is Never Run" activiti:class="com.example.SomeOtherListener"></serviceTask>
<sequenceFlow id="flow3" sourceRef="servicetask1" targetRef="shouldAlwaysRun"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow4" sourceRef="shouldAlwaysRun" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow5" sourceRef="parallelgateway1" targetRef="servicetask2"></sequenceFlow>
<serviceTask id="servicetask2" name="Flow Through task" activiti:class="com.example.SomeThirdListener"></serviceTask>
<sequenceFlow id="flow6" sourceRef="servicetask2" targetRef="endevent1"></sequenceFlow>
</process>
</definitions>
Adding a parallel join at the end resolves the issue, but the process I am working with is much more complicated than this example.
Any other suggestions?
01-31-2017 05:41 AM
This is a known architectural issue and one of the main reasons for the engine redesign that is part of version 6.
You can read about the problem here:
Activiti 6: An Evolution of the Core Engine | Small steps with big feet
Until you start using the Version 6 engine, you are best served using parallel joins after a parallel branch and I tend to use inclusive joins and branches as they tend to behave more predictably.
Cheers,
Greg
Explore our Alfresco products with the links below. Use labels to filter content by product module.