[hibernate-issues] [Hibernate-JIRA] Created: (EJB-351) Optimistic Locking Deadlocks with Application Manged EM in Threaded Environment
Allen Harvey (JIRA)
noreply at atlassian.com
Mon Apr 7 14:57:34 EDT 2008
Optimistic Locking Deadlocks with Application Manged EM in Threaded Environment
-------------------------------------------------------------------------------
Key: EJB-351
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-351
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.2.GA
Environment: Annotations 3.3.1.GA
Core 3.2
Windows XP Pro
Netbeans 6.01
Sun JDK 1.6.04
MSSQL 2000
Reporter: Allen Harvey
Attachments: hibernateJPAtest.zip
I have posted about this issue in the forums here: http://forum.hibernate.org/viewtopic.php?t=985460, but have received no reply. I am hoping it is a bug, and not a mistake on my part.
When using an application managed entity manager in a concurrent environment, the database is deadlocking. The scenario is this:
Create several bank accounts
Persist them
Create many (10) clients
Clients simultaneously transfer money randomly among the accounts as fast as possible
Each transfer between two accounts is a transaction
Optimistic lock exceptions are expected and handled (a new em is created and the transaction retried).
Depsite having annotated the account entity (@Version), settings ordered updates, using a thread-local entity manager, and setting the MS SQL 2000 db to read committed, the database deadlocks.
I have created a small sample application that reproduces the problem, it is attached. Finally, I tried this on Mysql 5.x as well, and that database also deadlocked, so it doesn't appear to be a database driver issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list