Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 36038 invoked from network); 31 Dec 2009 09:08:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Dec 2009 09:08:02 -0000 Received: (qmail 92029 invoked by uid 500); 31 Dec 2009 09:08:02 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 92000 invoked by uid 500); 31 Dec 2009 09:08:02 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 91992 invoked by uid 99); 31 Dec 2009 09:08:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Dec 2009 09:08:02 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI 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, 31 Dec 2009 09:07:51 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6EC78234C1EE for ; Thu, 31 Dec 2009 01:07:31 -0800 (PST) Message-ID: <1277216051.1262250451452.JavaMail.jira@brutus.apache.org> Date: Thu, 31 Dec 2009 09:07:31 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Resolved: (DERBY-4498) Incorrect double checked locking idiom used in VTIResultSet In-Reply-To: <1442778987.1262246369418.JavaMail.jira@brutus.apache.org> 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/DERBY-4498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen resolved DERBY-4498. --------------------------------------- Resolution: Duplicate This looks like a duplicate of DERBY-4497. Resolving as such. > Incorrect double checked locking idiom used in VTIResultSet > ----------------------------------------------------------- > > Key: DERBY-4498 > URL: https://issues.apache.org/jira/browse/DERBY-4498 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.5.3.0 > Environment: [daniel@daniel-desk src]$ uname -a > Linux daniel-desk.dyndns.org 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386 GNU/Linux > [daniel@daniel-desk src]$ java -version > java version "1.6.0" > Java(TM) SE Runtime Environment (build pxi3260sr4-20090219_01(SR4)) > IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20090215_29883 (JIT enabled, AOT enabled) > J9VM - 20090215_029883_lHdSMr > JIT - r9_20090213_2028 > GC - 20090213_AA) > JCL - 20090218_01 > Reporter: Daniel Luo > Original Estimate: 0.08h > Remaining Estimate: 0.08h > > In method setSharedState of class VTIResultSet, double checked locking idiom is used. But the field compileTimeConstants involved in the idiom is not declared with volatile modifier, which is incorrect. Declare the field compileTimeConstants with modifier volatile can quickly fix the problem. Below link and description explain the details. > http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#dcl > "The double-checked locking idiom (also called the multithreaded singleton pattern) is a trick designed to support lazy initialization while avoiding the overhead of synchronization. Sometimes it doesn't work correctly since the writes initializing the object and the write to the field storing the object instance can be reordered by the compiler or the cache, which would have the effect of returning what appears to be a partially constructed object instance. The result would be that we read an uninitialized object. In JVMs 1.5 or above, the use of the volatile keyword in field declaration would eliminate the problems." -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.