[ https://issues.apache.org/jira/browse/OPENJPA-1716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888930#action_12888930 ] Rick Curtis commented on OPENJPA-1716: -------------------------------------- I'll have to say I'm a bit apprehensive about blinding locking the BrokerImpl every time the StateManagerImpl needs to be locked... I posted this patch so I don't lose the code while I think about it. Ideally we'd be intelligent about locking and only lock the BrokerImpl when we need to... > Deadlock with openjpa.Multithreaded=true > ---------------------------------------- > > Key: OPENJPA-1716 > URL: https://issues.apache.org/jira/browse/OPENJPA-1716 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 2.0.0-M1, 2.0.0-M2, 2.0.0-M3, 2.0.0-beta, 2.0.0-beta2, 2.0.0-beta3, 2.0.0 > Reporter: Stefan Wokusch > Assignee: Rick Curtis > Attachments: OPENJPA-1716.PATCH > > > There is a Deadlock by using Multithreaded=true and work with some Threads on the same Entitymanager. > After many hours of debugging, i found a solution for that Deadlock: The Problem could be solved by adding another lock into the lock Method of the StateManagerImpl: > StateManagerImpl ~line3308 > /** > * Lock the state manager if the multithreaded option is set. > */ > protected void lock() { > if (_instanceLock != null){ > _broker.lock();//<- This is the new Part to fix the Deadlock > _instanceLock.lock(); > } > } > Worked for me without Problems for a long time. > Some other Configurations: > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> > > orm.xml > > ... > ... > > > > > > > > > > > > > > > > > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.