3

We are using Spring boot with JBPM (7.53.0.Final)

Steps Includes:

Step 1 : Perform a GET call (/rest/server/queries/processes/instance/correlation/${correlationKey}) to check if a workflow exists in JBPM.

Step 2 : If workflow does not exists then do a POST call (rest/server/containers/${workflow-name}/processes/${workflow-id}/instances/correlation/${correlationKey})

Most of the time, above mentioned steps works fine without any error.

But sometime it gives below error during in Step 2 :

SQL Error: 0, SQLState: 40001

ERROR: could not serialize access due to read/write dependencies among transactions Detail: Reason code: Canceled on identification as a pivot, during write. Hint: The transaction might succeed if retried.

Could not commit session"javax.persistence.OptimisticLockException: org.hibernate.exception.LockAcquisitionException: could not execute statement
    at org.hibernate.internal.ExceptionConverterImpl.wrapLockException(ExceptionConverterImpl.java:277)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:98)
    at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1602)
    at org.hibernate.query.Query.getResultList(Query.java:165)
    at org.jbpm.services.task.persistence.JPATaskPersistenceContext.queryStringWithParameters(JPATaskPersistenceContext.java:704)
    at org.jbpm.services.task.persistence.JPATaskPersistenceContext.queryWithParametersInTransaction(JPATaskPersistenceContext.java:527)
    at org.jbpm.services.task.audit.JPATaskLifeCycleEventListener.getAuditTask(JPATaskLifeCycleEventListener.java:519)
    at org.jbpm.services.task.audit.JPATaskLifeCycleEventListener.afterTaskActivatedEvent(JPATaskLifeCycleEventListener.java:102)
    at org.jbpm.services.task.events.TaskEventSupport.lambda$fireAfterTaskActivated$22(TaskEventSupport.java:192)
    at org.drools.core.event.AbstractEventSupport.notifyAllListeners(AbstractEventSupport.java:63)
Caused by: org.hibernate.exception.LockAcquisitionException: could not execute statement
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:120)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3297)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3824)
    at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:107)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
    at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
Caused by: org.postgresql.util.PSQLException: ERROR: could not serialize access due to read/write dependencies among transactions
  Detail: Reason code: Canceled on identification as a pivot, during write.
  Hint: The transaction might succeed if retried.
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
    at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
    at jdk.internal.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

I would like to know why this error occurs and what will be the solution to solve this issue ?

Muffin
  • 31
  • 1
  • 1
    It sounds like you need to configure your jBPM app's database connection to run in a different isolation level. But I wasn't able to find anything in the current jBPM documentation for how to do this. SUGGESTION: Look [here](https://stackoverflow.com/a/21715207/421195) and [here](https://docs.jboss.org/jbpm/v3.2/userguide/html_single/#isolationlevelofthejdbcconnection) to get started. – paulsm4 May 18 '22 at 20:23
  • I too didn't get it. why it is behaving in such a way! Also JBPM is not unable to handle concurrent request. – Muffin May 21 '22 at 20:14
  • Q: Have you reached out to the jBPM community yet? Options include 1) https://www.jbpm.org/, 2) https://www.jbpm.org/community/getHelp.html, 3) https://groups.google.com/g/jbpm-development – paulsm4 May 21 '22 at 22:46
  • Hello paulsm4, I have the links provided by you. In the google group I should find one ticket concern regarding the same which I asked but it remained unanswered. Google Group Link : https://groups.google.com/g/jbpm-development/c/ZakNLIGsWX4/m/vv1YAcxOEAAJ – Muffin May 22 '22 at 12:15

0 Answers0