Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 8239 invoked from network); 20 Jan 2005 22:32:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Jan 2005 22:32:47 -0000 Received: (qmail 36298 invoked by uid 500); 20 Jan 2005 22:32:46 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 36271 invoked by uid 500); 20 Jan 2005 22:32:45 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 36255 invoked by uid 99); 20 Jan 2005 22:32:45 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from ajax-1.apache.org (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 20 Jan 2005 14:32:44 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (8.12.11/8.12.11) with ESMTP id j0KMWg91014350 for ; Thu, 20 Jan 2005 23:32:42 +0100 Message-ID: <1031432103.1106260362344.JavaMail.jira@ajax.apache.org> Date: Thu, 20 Jan 2005 23:32:42 +0100 (CET) From: "Sunitha Kambhampati (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Closed: (DERBY-94) Lock not being released properly, possibly related to occurence of lock escalation In-Reply-To: <48647506.1102460768976.JavaMail.apache@nagoya> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-94?page=history ] Sunitha Kambhampati closed DERBY-94: ------------------------------------ I have tested it and it works ok, so closing the bug. > Lock not being released properly, possibly related to occurence of lock escalation > ---------------------------------------------------------------------------------- > > Key: DERBY-94 > URL: http://issues.apache.org/jira/browse/DERBY-94 > Project: Derby > Type: Bug > Components: Store > Versions: 10.0.2.1 > Environment: all > Reporter: Sunitha Kambhampati > Assignee: Suresh Thalamati > Attachments: Derby94Test.java, Derby94Test_Output, derby.log > > In the following scenario: > > String sel = "select * from t1 FOR UPDATE of i2"; > PreparedStatement ps1 = conn.prepareStatement (sel); > int val = 300; > ps1.setMaxRows(val); > ResultSet rs = ps1.executeQuery(); > String ins = "Update t1 set i2=? WHERE CURRENT OF "+rs.getCursorName() ; > PreparedStatement ps2 = conn.prepareStatement(ins); > ps2.setInt(1,iteration); > while(rs.next()) > { > ps2.executeUpdate(); > }; > // print lock table information > System.out.println("Lock Table before commit transaction"); > printLockTable(conn); > conn.commit(); > > Running the above transaction twice causes a lock timeout the second time. > It seems like locks are not being released properly on the table even after the transaction commits and the connection is closed. Also, this condition seems to happen only when lock escalation to table lock occurs. By increasing lock escalation threshold to prevent lock escalation and with only row level locking, the locks are released properly. > I printed out the locks information and see a U row level lock on the table , and also a table level lock as a result of lock escalation. After commit, and resultset being closed, the U row level lock is not released. Thus in the second iteration of the test, the unreleased U row level lock causes a lock timeout to happen. In case of the second iteration of the test, the lock table shows the previous U row lock with a null transaction id. This is not right. > The transactions are running at the default isolation level ( read committed). > By default, the lock escalation threshold is set to 5000 > http://incubator.apache.org/derby/manuals/tuning/perf80.html#IDX547 > I will be attaching the program for reproduction. To reproduce the problem with less number of rows in the table, please run the program with the following derby properties set > derby.locks.deadlockTrace=true > derby.locks.escalationThreshold=110 > -- 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 - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira