Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 79670 invoked from network); 18 Jun 2008 11:33:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jun 2008 11:33:37 -0000 Received: (qmail 558 invoked by uid 500); 18 Jun 2008 11:33:38 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 530 invoked by uid 500); 18 Jun 2008 11:33:38 -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 518 invoked by uid 99); 18 Jun 2008 11:33:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2008 04:33:38 -0700 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; Wed, 18 Jun 2008 11:32:57 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F1C4C234C143 for ; Wed, 18 Jun 2008 04:32:45 -0700 (PDT) Message-ID: <131930575.1213788765989.JavaMail.jira@brutus> Date: Wed, 18 Jun 2008 04:32:45 -0700 (PDT) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-2861) Thread safety issue in TableDescriptor In-Reply-To: <6034208.1182524427532.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dag H. Wanvik updated DERBY-2861: --------------------------------- Attachment: derby-2861-2.diff Thanks for looking at this, Kristian! Uploading a new version, #2. Btw, regression tests passed for #1. As for your comments: a) Yes, bad cut and paste job from the javadoc sample code ;) Fixed. b) Yes, I forgot, thank. Fixed. > Thread safety issue in TableDescriptor > -------------------------------------- > > Key: DERBY-2861 > URL: https://issues.apache.org/jira/browse/DERBY-2861 > Project: Derby > Issue Type: Bug > Components: SQL > Environment: Tested on a dual-core 3GHz Pentium machine running Windows Vista Business, using JDK 1.4.2_13 and Derby trunk revision 548822. > Reporter: Jeff Clary > Assignee: Dag H. Wanvik > Attachments: derby-2861-1.diff, derby-2861-2.diff, experiment.diff, TestEmbeddedMultiThreading.java > > > A NullPointerException occurs in org.apache.derby.iapi.sql.dictionary.TableDescriptor.getObjectName when accessing the same object on many threads (each with its own connection). The attached test program starts N threads each creating and then dropping a separate view against the same source view, repeated M times. I can reproduce the problem with N=100 and M=100 on my machine, but not every run. > An instance member named referencedColumnMap is checked for null at the top of the getObjectName method, but later when it is dereferenced it is null, because it was set to null by another thread. I am not sure what getObjectName is used for other than error reporting. I have considered a fix of just saving the non-null reference as a method variable, to avoid the later NullPointerException. But I don't know what unintended consequences this may have. > When the test program does show the exception, the stack trace looks like this: > java.lang.NullPointerException > at org.apache.derby.iapi.sql.dictionary.TableDescriptor.getObjectName(TableDescriptor.java:758) > at org.apache.derby.impl.sql.depend.BasicDependencyManager.getPersistentProviderInfos(BasicDependencyManager.java:677) > at org.apache.derby.impl.sql.compile.CreateViewNode.bindViewDefinition(CreateViewNode.java:287) > at org.apache.derby.impl.sql.compile.CreateViewNode.bind(CreateViewNode.java:183) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345) > at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:119) > at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:745) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:568) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517) > at TestEmbeddedMultiThreading.executeStatement(TestEmbeddedMultiThreading.java:109) > at TestEmbeddedMultiThreading.access$100(TestEmbeddedMultiThreading.java:10) > at TestEmbeddedMultiThreading$ViewCreatorDropper.run(TestEmbeddedMultiThreading.java:173) > at java.lang.Thread.run(Thread.java:534) > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.