Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 8676 invoked from network); 16 Apr 2008 23:39:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2008 23:39:34 -0000 Received: (qmail 44602 invoked by uid 500); 16 Apr 2008 23:39:34 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 44150 invoked by uid 500); 16 Apr 2008 23:39:33 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 44139 invoked by uid 99); 16 Apr 2008 23:39:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 16:39:33 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.6.21] (HELO gmp-eb-inf-1.sun.com) (192.18.6.21) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 23:38:40 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-2-fe1.eu.sun.com [192.18.6.10]) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m3GNd0CS016578 for ; Wed, 16 Apr 2008 23:39:00 GMT Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JZF00G01YTMUB00@fe-emea-09.sun.com> (original mail from Knut.Hatlen@Sun.COM) for derby-user@db.apache.org; Thu, 17 Apr 2008 00:39:00 +0100 (BST) Received: from localhost ([193.71.105.147]) by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JZF00KZOZ0YGO80@fe-emea-09.sun.com> for derby-user@db.apache.org; Thu, 17 Apr 2008 00:39:00 +0100 (BST) Date: Thu, 17 Apr 2008 01:38:16 +0200 From: Knut Anders Hatlen Subject: Re: Deadlock when getting DB metadata In-reply-to: <48065E5C.9010206@volny.cz> Sender: Knut.Hatlen@Sun.COM To: Derby Discussion Message-id: Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: <48065E5C.9010206@volny.cz> User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (usg-unix-v) X-Virus-Checked: Checked by ClamAV on apache.org Svata Dedic writes: > Hello, > > I am new to this list - so please accept my apologies if I ask something > well known (I did a keyword google/list search with no reasonable results) > > I have the following issue: my code changes DB structure (create a > column), then immediately after setting autocommit back to true, the > code rescans the DB metadata > DatabaseMetaData.getColumns(catalog, schemaName, tableName, null); > [...] > I am sometimes getting a deadlock with these operations: > I am quite positive that, at the time, no other threads access the > database (and there are no pending DB operations on the threaddump while > waiting on the lock). > > I've seen the deadlock occur during several get-metadata operations > (getImportedKeys, ...), each time waiting on the SYSSTATEMENTS > apparently because of internally constructed PreparedStatement. > > Can anyone give me pointers how to solve or avoid these issues ? I am > able to reproduce this rather reliably, so any guidance what to test, > what to debug or log in order to pinpoint the bug would be most appreciated. Do the deadlock exceptions propagate out to your code, or do you only see them in derby.log? I know that there is some code in that area that may cause internal deadlocks or timeouts, but it successfully recovers from the errors and doesn't expose the exceptions to the users. When that happens, you may experience that your application hangs for a while before it successfully continues, but the deadlock may still be logged in derby.log. That bug is tracked here: https://issues.apache.org/jira/browse/DERBY-177 -- Knut Anders