JBPM operation results in deadlock on MS SQL Server

Solution Unverified - Updated -

Issue

I have a simple jBPM process with a wait state and a timer. Before the timer expires, we use the following code to force the token to move on:

        try {
            JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
            JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();

            ProcessInstance instance = jbpmContext.loadProcessInstanceForUpdate(processId);
            instance.signal();
        } finally {  
            jbpmContext.close();  
    }

Everything is working fine if I am running one instance, but if we trigger multiple process instances concurrently from multiple threads, this results in a database deadlock:

ERROR (WorkManager(2)-34) javax.ejb.EJBException: org.hibernate.exception.SQLGrammarException: 
      could not initialize a collection: [org.jbpm.graph.def.Node.exceptionHandlers#282]
...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283)

Environment

  • JBoss Enterprise SOA Platform 5
  • jBPM 3.2.x
  • Microsoft SQL Server 2008

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content