openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1716) Deadlock with openjpa.Multithreaded=true
Date Fri, 16 Jul 2010 15:33:49 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889212#action_12889212
] 

Rick Curtis commented on OPENJPA-1716:
--------------------------------------

I'm somewhat confused by OPENJPA-453 because it seems like there are two issues in that one
(Correct me if I'm wrong)?

Either way, I think this issue is related to the threading concerns that are detailed near
the middle/bottom of OPENJPA-453. After reading through OPENJPA-453 I'm pretty sure that the
posted patch to this JIRA isn't the right change.... There is a larger issue than this single
deadlock being reported.  

I'd feel more comfortable fixing these deadlocks on a case by case basis rather than the blind
"lock the Broker before the StateManager in all cases". Unfortunately at this point in time
I don't have the cycles to dedicate to fixing the locking design(the root issue) of OpenJPA
when running multithreaded.

> 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:
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
> 	<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
> 		<mapping-file>orm.xml</mapping-file>
> 		
> 		<class>...</class>
> 		<class>...</class>
> 		
> 		<properties>
> 			<property name="openjpa.OrphanedKeyAction" value="log(Channel=Orphans, Level=TRACE)"
/>
> 			<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=80"
/>
> 			<property name="openjpa.Multithreaded" value="true" />
> 			<property name="openjpa.InverseManager" value="true" />
> 			<property name="openjpa.LockManager" value="none" />
> 			<property name="openjpa.WriteLockLevel" value="none" />
> 			<property name="openjpa.Compatibility" value="
> 					QuotedNumbersInQueries=true, 
> 					CopyOnDetach=true,
> 					cascadeWithDetach=true,
> 					superclassDiscriminatorStrategyByDefault=false
> 			" />
> 			<property name="openjpa.DetachState" value="fetch-groups" />
> 			<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
> 			<!-- Default DataSource -->
> 			<property name="openjpa.ConnectionURL" value="jdbc:h2:db/test" />
> 			<property name="openjpa.ConnectionDriverName" value="org.h2.Driver" />
> 		</properties>
> 	</persistence-unit>
> </persistence>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message