Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 34276 invoked from network); 12 Mar 2006 16:11:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Mar 2006 16:11:05 -0000 Received: (qmail 38140 invoked by uid 500); 12 Mar 2006 16:11:04 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 38107 invoked by uid 500); 12 Mar 2006 16:11:03 -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 38098 invoked by uid 99); 12 Mar 2006 16:11:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Mar 2006 08:11:03 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Mar 2006 08:11:03 -0800 Received: from ajax (localhost.localdomain [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id E1DFCD49FC for ; Sun, 12 Mar 2006 16:10:41 +0000 (GMT) Message-ID: <1363626551.1142179841922.JavaMail.jira@ajax> Date: Sun, 12 Mar 2006 16:10:41 +0000 (GMT) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1095) Closing an embedded connection does not seem to close associated EmbedStatements In-Reply-To: <949739842.1142008131793.JavaMail.jira@ajax> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1095?page=comments#action_12370077 ] Kristian Waagan commented on DERBY-1095: ---------------------------------------- I see your point, but I still think Derby is buggy. The repro script executes a statement, closes the connection then asks the resultset if it is closed. The resultset says it is not, and based on this the repro then executes an operation that causes an exception to be thrown. A correct answer from ResultSet.isClosed() would not have caused an exception in the repro. According to the JDBC4 spec: "A ResultSet is closed if the method close has been called on it, or if it is automatically closed." I thought closing the underlying connection should close all associated resources, including the resultset(s). Am I mistaken? I notice that ResultSet.isClosed() simply returns a variable ('isClosed'), and to me it seems that the state of this variable is not maintained correctly (have not looked at the code), thus the ResultSet.isClosed() method suffers the same problem as Statement.isClosed(). We must either ensure the internal state is kept correct, or we must add extra checks to the isClosed methods. Although the latter solution is very simple (at least for Statement), I personally think it would be better if the close methods were executed also when the resources are automatically "closed". Dan, since you have assigned yourself to this issue, can you tell me how your (planned) solution would affect the internal state variables in ResultSet and Statment, so that I can fix Statement.isClosed accordingly? > Closing an embedded connection does not seem to close associated EmbedStatements > -------------------------------------------------------------------------------- > > Key: DERBY-1095 > URL: http://issues.apache.org/jira/browse/DERBY-1095 > Project: Derby > Type: Bug > Components: JDBC > Versions: 10.2.0.0 > Reporter: Kristian Waagan > Assignee: Daniel John Debrunner > Priority: Minor > Attachments: Derby1095Repro.java > > Closing an embedded connection (calling EmbedConnection.close()) does not seem to close associated EmbedStatements. > The severity of the bug is not determined. The least severe case is that the internal EmbedStatement variable 'active' is not updated accordingly, the most severe case is that the the resources bound to EmbedStatement will not be viable for garbage collection until the EmbedStatement itself is (if user keeps references to it). > If methods on the statement are called, Derby will correctly throw an NoCurrentConnection exception, but the close() method is still never called automatically. > The problem also seem to extend down to ResultSet.isClosed(), but this is probably due to the bug in EmbedStatement. > Problem detected while fixing DERBY-953; implement Statement.isClosed(). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira