Optimistic-Locking-Exceptions, Deadlocks, Foreign-Key-Violations,

Hello,

I started porting the main process of an application to run on camunda some weeks ago.
Until now the process was hardcoded in the application. In the past there where so problems with transaction scopes and optimistic locking exceptions.

The main reason to switch to the camunda process engine was to make it easier to handle such error conditions within the BPMN process.
But now, during the development and testing the process I have seen for my opinion way to many Optimistic-Locking-Exceptions, Deadlocks, Foreign-Key-Violations and so on IN the the camunda process engine (additionally with cryptic error messages).

Did I miss some kind of magic switch to avoid these problems?

Yes, the process is running two parallel branches and a sub process, but I expected the engine could handle these without crashing.

Hi @bmaehr,

try to model the process with an Asynchronous Before on the joining parallel gateway: https://docs.camunda.org/manual/7.10/user-guide/process-engine/transactions-in-processes/#optimistic-locking

Which database do you use?

Cheers, Ingo

Hello @Ingo_Richtsmeier
There is no joining parallel gateway. Do I need one? Basically the process looks like a horizontal ‘h’.

The database is PostgreSQL.

Hi @bmaehr,

OptimisticLockingExceptions occure when one row in the database should be changed by a second transaction.

From my experience the two most common reasons are:

  • joining parallel branching
  • database configuration with another isolkation level than READ_COMMITED.

How does your process look like? Could you please upload the bpmn xml file?

How do you configure your database connection?

Hi @Ingo_Richtsmeier,

After I ADDED now the joining the parallel branch the Exception disappeared.

I think it is not helpful to upload the bpmn, because it is a complex process with some technically needed workarounds.

The database connection is defined in spring boot for the application and used by the camunda implementation with the default implementation.

I’m again getting a org.camunda.bpm.engine.OptimisticLockingException:
ENGINE-03005 Execution of DELETE EventSubscriptionEntity[22513acc-4f1f-11e9-b743-aced5c9ede86] failed.

In the bpmn model are no parallel branches.
How is it possible to debug something like this and find the reason?

I think I found the cause of problem: It happend because the message of a boundary event was sent twice during a short time.

But in my opinion that is valid case and should not produce that kind of exception.

1 Like