From dev-return-19047-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed May 4 22:38:42 2011 Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97FE93E4F for ; Wed, 4 May 2011 22:38:42 +0000 (UTC) Received: (qmail 49237 invoked by uid 500); 4 May 2011 22:38:42 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 49195 invoked by uid 500); 4 May 2011 22:38:42 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 49187 invoked by uid 99); 4 May 2011 22:38:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2011 22:38:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2011 22:38:41 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 30511C1B61 for ; Wed, 4 May 2011 22:38:03 +0000 (UTC) Date: Wed, 4 May 2011 22:38:03 +0000 (UTC) From: "Jody Grassel (JIRA)" To: dev@openjpa.apache.org Message-ID: <1409185813.23115.1304548683194.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <695317041.22742.1304540043315.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (OPENJPA-1993) Deadlock Potential with ORM XML Processing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029019#comment-13029019 ] Jody Grassel commented on OPENJPA-1993: --------------------------------------- Checked in the fix for this issue. To preserve original behavior, the ContextClassLoader override will only take place if the following OpenJPA Compatibility option is set: openjpa.Compatibility="OverrideContextClassloader=true" > Deadlock Potential with ORM XML Processing > ------------------------------------------ > > Key: OPENJPA-1993 > URL: https://issues.apache.org/jira/browse/OPENJPA-1993 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.2.0, 1.2.1, 1.2.2, 2.0.0, 2.0.1, 2.1.0 > Reporter: Jody Grassel > Assignee: Jody Grassel > > There exists the potential for deadlock with the ORM XML processing function. In an environment > with multiple threads (such as an application server), operations (such as creating a new > EntityManagerFactory or transformation Classloader activity) can lead to a point where > a Xerces SAX Parser (acquired by XMLFactory) is constituted and executed. Xerces calls > Thread.currentThread().getContextClassloader() during its execution to construct the > SAXParser (via ObjectFactory.createObject()). This means that within the call to Xerces, > a ClassLoader lock will be attempted on the Thread's ContextClassLoader. If there is already > a lock with a ClassLoader higher in the heirarchy, and another thread with a lock on the > same ContextClassLoader that is waiting to acquire a lock on a higher level ClassLoader, then > a deadlock will occur. > A solution to this problem is to temporally set the Thread's ContextClassLoader at the > point where XML APIs are invoked (such as in XMLFactory, XMLMetaDataParser) to the > ClassLoader that loaded the OpenJPA implementation classes. This will prevent Xerces from > starting with a lower level classloader and avoid this deadlock potential. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira