0

We are facing error 'Process instance XXX is disconnected' very frequently in our project and holding up the tasks operations.

We are using SynchronizedTaskService for task operation:

Code snippet are below:

final RuntimeManager runtimeManager = RuntimeEngineFacory.getRuntimeManager();
final RuntimeEngine engine = runtimeManager.getRuntimeEngine(EmptyContext.get());
SynchronizedTaskService taskService = (SynchronizedTaskService) engine.GetTaskService();

It was raised in one of JBPM bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1161574

Please help if anyone has any clue.

Dynamic Meta
  • 71
  • 13

2 Answers2

2

After lots of research and finding (including different community discussion) came to little close to this issue solution.

Below are the main reason of this:

Using the (runtime manager) Singleton strategy with JTA transactions (UserTransaction or CMT) is not recommended because there is a race condition when using this. This race condition can result in an IllegalStateException with a message similar to "Process instance XXX is disconnected."

If you are using Singleton Strategy then make sure you are Synchronizing your call to JBPM.

Solution

Better to use Per Process Runtime Strategy so that JBPM engine will make sure strict relationship between Process Instance and Session. Session will remain associated till entire lifetime of Process Instance. This will also assure that Session are not shared across. This is I think most advance strategy available in JBPM.

Dynamic Meta
  • 71
  • 13
0

Finally I am able to resolved this issue.

For benefit of whoever facing issue: - This issue appears whenever you have not properly managed transactions

There were some place we were managed transaction incorrectly and somehow JBPM internally InternalKnowledgeRuntime set to null.

By the way this errors throws from

  • class: ProcessInstanceImpl
  • method: getProcess()

    public Process getProcess(){
       if(this.process == null){
         if(processXml == null){
           if(kruntime == null){
              throw new RuntimeException("Process instance " + id + "[" + processId + "] is disconnected. "));
          }else{
             other code ...........
          }
        }
      }
    }
    
TT.
  • 15,774
  • 6
  • 47
  • 88
Dynamic Meta
  • 71
  • 13