NullPointerException when using InclusiveGateway Join Behavior

We are using Flowable version 6.5.0 and have a process which contains Start Event, Inclusive Gateway with two flows and End Event.

Below is the sample bpmn for the process where emailDelegate is called in each flow.This is simple java Delegate with logic to send emails.

<process id=“TestInclusiveGateway” name=“TestInclusiveGateway” isExecutable=“true”>
<startEvent id=“Start”/>
<inclusiveGateway id=“fork”/>
<inclusiveGateway id=“join”/>
<serviceTask id=“EmailToManagers” flowable:delegateExpression=“${emailDelegate}”>
<extensionElements>
<flowable:field name=“exitOnError” stringValue=“false”/>
</extensionElements>
</serviceTask>
<serviceTask id=“EmailToLeads” flowable:delegateExpression=“${emailDelegate}”>
<extensionElements>
<flowable:field name=“exitOnError” stringValue=“false”/>
</extensionElements>
</serviceTask>
<serviceTask id=“EmailToAllEmployees” flowable:delegateExpression=“${emailDelegate}”>
<extensionElements>
<flowable:field name=“exitOnError” stringValue=“false”/>
</extensionElements>
</serviceTask>
<endEvent id=“End”/>
<sequenceFlow sourceRef=“Start” targetRef=“fork”/>
<sequenceFlow sourceRef=“fork” targetRef=“EmailToManagers”>
<conditionExpression xsi:type=“tFormalExpression”>${toManagers == true}
</sequenceFlow>
<sequenceFlow sourceRef=“fork” targetRef=“EmailToLeads”>
<conditionExpression xsi:type=“tFormalExpression”>${toLeads == true}
</sequenceFlow>
<sequenceFlow sourceRef=“EmailToManagers” targetRef=“join”/>
<sequenceFlow sourceRef=“EmailToLeads” targetRef=“join”/>
<sequenceFlow sourceRef=“join” targetRef=“EmailToAllEmployees”/>
<sequenceFlow sourceRef=“EmailToAllEmployees” targetRef=“End”/>
</process>

When the process reaches “join” we are getting NullPointerException as below.
Do note that the conditionExpressions on both the flows are evaluating to true.

java.lang.NullPointerException: null
at org.flowable.engine.impl.bpmn.behavior.InclusiveGatewayActivityBehavior.executeInclusiveGatewayLogic(InclusiveGatewayActivityBehavior.java:72)
at org.flowable.engine.impl.bpmn.behavior.InclusiveGatewayActivityBehavior.execute(InclusiveGatewayActivityBehavior.java:53)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:290)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:163)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:118)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:342)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:83)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:56)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:56)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.RuntimeServiceImpl.startProcessInstanceByKeyAndTenantId(RuntimeServiceImpl.java:136)

I’ve tracked it down to the following where “allExecutions” have 2 entries one with ActivityId “join” and other entry is parent which don’t have any ActivityId which is throwing error in the if check given below

protected void executeInclusiveGatewayLogic(ExecutionEntity execution) {
CommandContext commandContext = Context.getCommandContext();
ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
this.lockFirstParentScope(execution);
Collection allExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(execution.getProcessInstanceId());
Iterator executionIterator = allExecutions.iterator();
boolean oneExecutionCanReachGatewayInstance = false;

    while(!oneExecutionCanReachGatewayInstance && executionIterator.hasNext()) {
        ExecutionEntity executionEntity = (ExecutionEntity)executionIterator.next();
        if (!executionEntity.getActivityId().equals(execution.getCurrentActivityId())) {

Should we use any other qualifier for the inclusiveGateway ? Any suggestions would be greatly appreciated.

Thanks in advance.

We are still looking for the solution, any help would be appreciated.