Problem with bonita engine - Hibernate transactions - Deadlock

Hello community, firstable sorry for my english.
 
We have issues with our process, we have been analyzing the troubles which could be related with bonita engine and its connections and transactions with the database engine.
 
The exceptions from Bonita's log are:
 
1) Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.ow2.bonita.runtime.model.Execution#79715]
        
2) org.ow2.bonita.services.impl.DefaultCommandService execute
SEVERE: exception while executing command org.ow2.bonita.runtime.event.ExecuteJobsCommand@420e4191: Unexpected Exception arrived in Bonita: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.ow2.bonita.runtime.model.Execution#79715]
 
3) SEVERE: exception while executing command org.ow2.bonita.runtime.event.JobExceptionHandler@32d55b32: null
Nov 8, 2013 10:37:43 AM org.ow2.bonita.runtime.event.JobExecutorThread run
SEVERE: Exception in event block: java.lang.NullPointerException
 
4) SEVERE: exception while executing command org.ow2.bonita.runtime.event.ExecuteJobsCommand@babf42d: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
Nov 8, 2013 10:22:24 AM org.hibernate.jdbc.BatchingBatcher doExecuteBatch
SEVERE: Exception executing batch: 
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
        at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
        at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:70)
        at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:90)
 
5) Nov 8, 2013 12:36:58 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1213, SQLState: 40001
Nov 8, 2013 12:36:58 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Deadlock found when trying to get lock; try restarting transaction
Nov 8, 2013 12:36:58 PM org.hibernate.AssertionFailure <init>
SEVERE: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null identifier
 
We have detected that when we handle asynchronism in our processes, the engine throws more exceptions than when we handle synchronism. A clear case is this, if we use the multi-intanciation mechanism in asynchronic way and we look through the engine of the rest API for certain information, the processes go down, in other words, when the engine is instanciated, we can't read or see it.
 
This behavior made us handle a synchronization level in our application to avoid the problem, but it is strange that the engine doesn't have a right administration of this kind of things when it provides the facilities to handle paralelism like asynchronic multi-intanciation by itself.
 
Could you help us with this problems in order to know if this is an engine problem, or if there is some configuration missing, or if this could be a problem in our defined processes?
 
We have this enviroment:
 
OS: Red Hat Linux 2.6.32-343.el6.x86_64 x86_64 x86_64 x86_64 GNU/Linux
Database: Mysql Server 5.1.66
Bonita:  BOS-5.10-Tomcat-6.0.35
 
Thanks for your suggestions.

This sort of thing can happen if you are updating the same business data record from two processes (unless one is a sub-process of the other). Care needs to be taken in the design to avoid that kind of clash.

It seems to be a bug, fixable in source code…

Try this …

http://community.bonitasoft.com/questions-and-answers/correct-way-update-bdm-record-multiple-concurrent-processes

Did you find resolution to this problem?

Hi, what is your mysql driver, which mysql storage engine are you using ? what is your datasource configuration ?