From dev-return-12245-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Thu Jun 04 18:09:20 2009 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 22562 invoked from network); 4 Jun 2009 18:09:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jun 2009 18:09:20 -0000 Received: (qmail 88444 invoked by uid 500); 4 Jun 2009 18:09:32 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 88386 invoked by uid 500); 4 Jun 2009 18:09:32 -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 88376 invoked by uid 99); 4 Jun 2009 18:09:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 18:09:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 18:09:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 590AE234C004 for ; Thu, 4 Jun 2009 11:09:07 -0700 (PDT) Message-ID: <503872467.1244138947335.JavaMail.jira@brutus> Date: Thu, 4 Jun 2009 11:09:07 -0700 (PDT) From: "Craig Russell (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-453) Evicting embedded object nullifies statemanager In-Reply-To: <31410390.1196085223035.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12716349#action_12716349 ] Craig Russell commented on OPENJPA-453: --------------------------------------- Ravi, I've given you contributor status on OpenJPA JIRA. Let me know if that doesn't work for you. > The race condition arises from the repeated use of the following logic in enhancement added code (expressed as pseudo code here): > [PC object class].pc[SomeMethod] > { > if (pcStateManager == null) > ... do something by default with current values in > this object > else > { > ... use pcStateManager, likely resulting in an > eventual lock, and possibly in a call back to > this object's PersistenceCapable interface > methods > ... > } > } >The race condition arises because the check of the value of pcStateManager is obtained and used twice in succession without first locking the state manager. Another thread using and having locked the state manager has the time to alter the state of this pc object, including nulling out its pcStateManager reference. The use of the multithreaded flag was intended to add a bit of overhead to the StateManager in exchange for thread-safe behavior. It's understandable why a "context" StateManager lock was used: it prevents many cases of deadlock for multithreaded access. But the footprint of sm->pc seems to be small. Would it be possible to use a simple semaphore before calling the pc methods? For example, void provideField(PersistenceCapable pc, FieldManager store, int field) { if (multithreaded) { FieldManager beforeFM = _fm; _fm = store; synchronized(this) { pc.pcProvideField(field); } // Retaining original FM because of the possibility of reentrant calls _fm = beforeFM; } else { FieldManager beforeFM = _fm; _fm = store; pc.pcProvideField(field); // Retaining original FM because of the possibility of reentrant calls _fm = beforeFM; } } > Evicting embedded object nullifies statemanager > ----------------------------------------------- > > Key: OPENJPA-453 > URL: https://issues.apache.org/jira/browse/OPENJPA-453 > Project: OpenJPA > Issue Type: Bug > Environment: Kodo 4.1.4, Ms sql server 2005, jTDS 1.2, jdk 1.6 > Reporter: Christiaan > Assignee: David Ezzio > Attachments: OpenJPABug453Embedded.zip, openJPATestCase.zip, TestCaseEvictEmbedded.zip > > > I am noticing the following behaviour: If evict() is called on an embedded > object the statemanager is nullified which is in contrast to non-embedded > objects. Subsequently, calling JDOHelper.getPersistenceManager() on the > evicted embedded object returns null. Is this the correct behaviour? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.