[jboss-user] [jBPM] - Concurrency problem with persistent JBPM + Drools

Tim Vercruysse do-not-reply at jboss.com
Fri Feb 15 10:28:30 EST 2013


Tim Vercruysse [https://community.jboss.org/people/vercruysse_tim] created the discussion

"Concurrency problem with persistent JBPM + Drools"

To view the discussion, visit: https://community.jboss.org/message/797940#797940

--------------------------------------------------------------
Hi all,

We have a problem that when multiple threads try to fetch process variables an exception is thrown:
java.lang.NullPointerException
               org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:67)
               org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:189)


the code in our EJB is:
public Object getProcessVar(long processInstanceId, String varName) {
     try{
          WorkflowProcessInstance p = (WorkflowProcessInstance) ksession.getProcessInstance(processInstanceId);
          var = p.getVariable(varName);
     } catch(Throwable x) {x.printStackTrace()}
return var;
}


This exception is thrown when we do multiple calls (around 40) from our Spring context to this EJB method.

We found that most of the time that when we do a context switch from Spring to EJB  drools automatically tries to update a ProcessInstanceInfo entity with procesInstanceInfo.update() or invokes jPAProcessInstanceManager.clearProcessInstances() to disconnect all the processInstances. It happens now that drools tries to update a processInstanceInfo that points to a processInstance that previously has been disconnected, hence the error.

My guess is that the multiple threads mess up the order of the transactions so that some processInstanceInfo entities are in invalid states.

Does anyone know how to solve this issue?

We use JBPM 5.2, Spring 3 and Hibernate 4.
KnowledgeSession: statefullKnowledgeSession, with a commandBasedWSHumanTaskHandler.
Persistence transactions: JTA and JBossTransactionManagerLookup

Thanks!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797940#797940]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130215/38671391/attachment.html 


More information about the jboss-user mailing list