"SessionNotFoundException" on sub-process completion in BPM Suite 6.0.x

Solution Verified - Updated -

Environment

  • Red Hat JBoss BPM Suite
    • 6.0.x

Issue

In BPM Suite 6.0.x, trying to use a Reusable sub-process to call another sub-process, when following conditions are satisfied:
+ reusable sub-process's Wait For Completion field is set to false
+ deployment's runtime strategy is set to Per Process Instance
+ parent (main) process completes before sub-process's completion (for example, a timer event is used in sub-process)
following exception is thrown when sub-process completes:

17:01:26,091 ERROR [org.jbpm.process.instance.timer.TimerManager] (pool-24-thread-1) Error when executing timer job: org.drools.core.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@4acaea0
    at org.drools.core.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1241) [drools-core-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:892) [drools-core-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:90) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
......
Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [com.sample.subprocess:2 - :4] -- No session found for context 1
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:161) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:337) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:296) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
......
    at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:118) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.drools.core.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1239) [drools-core-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    ... 23 more
Caused by: org.kie.internal.runtime.manager.SessionNotFoundException: No session found for context 1
    at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.getRuntimeEngine(PerProcessInstanceRuntimeManager.java:102) [jbpm-runtime-manager-6.0.3-redhat-4.jar:6.0.3-redhat-4]
    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:297) [jbpm-flow-6.0.3-redhat-4.jar:6.0.3-redhat-4]
......

Resolution

This is a bug, and reported here: SessionNotFoundException when using Reusable sub-process with [Wait For Completion] = false and Per_Process_Instance strategy
The fix will be included in BPM Suite 6.1.0

Alternatively, please try to update either Wait For Completion field value for the sub-process in process definition, or deployment's runtime strategy.

Root Cause

When the sub-process is completed, it will signal the parent process its completion. If parent process is completed already at the time, the exception is thrown. This only happens when (Wait For Completion is true) AND (using Per Process Instance runtime strategy).

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.