Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 19993 invoked from network); 11 Apr 2011 23:49:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Apr 2011 23:49:56 -0000 Received: (qmail 3531 invoked by uid 500); 11 Apr 2011 23:49:56 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 3505 invoked by uid 500); 11 Apr 2011 23:49:56 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 3498 invoked by uid 99); 11 Apr 2011 23:49:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Apr 2011 23:49:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Apr 2011 23:49:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 62F6F23889BF; Mon, 11 Apr 2011 23:49:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1091258 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Date: Mon, 11 Apr 2011 23:49:33 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110411234933.62F6F23889BF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dag Date: Mon Apr 11 23:49:33 2011 New Revision: 1091258 URL: http://svn.apache.org/viewvc?rev=1091258&view=rev Log: DERBY-5185 store/rollForwardRecovery.sql stuck in RAFContainer4.recoverContainerAfterInterrupt() during shutdown Backported fix from trunk of patch derby-5185-1a as svn merge -c 1091221 https://svn.apache.org/repos/asf/db/derby/code/trunk Patch derby-5185-1a.diff. Avoid waiting forever in the loop in recoverContainerAfterInterrupt where we wait for other concurrent threads to hit the wall (having seen ClosedChannelException), i.e. so we know they waiting for this thread to clean up. The counting logic (threadsInPageIO) here needs to be correct, if there is an error, we could risk waiting forever, as seen in this issue. This patch should be followed up by a patch to correct the logic, but until such time, this patch improves on the situation. Modified: db/derby/code/branches/10.8/ (props changed) db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Propchange: db/derby/code/branches/10.8/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Apr 11 23:49:33 2011 @@ -1,2 +1,2 @@ /db/derby/code/branches/10.7:1061570,1061578,1082235 -/db/derby/code/trunk:1063809,1088633,1091000 +/db/derby/code/trunk:1063809,1088633,1091000,1091221 Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java?rev=1091258&r1=1091257&r2=1091258&view=diff ============================================================================== --- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java (original) +++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Mon Apr 11 23:49:33 2011 @@ -820,8 +820,10 @@ class RAFContainer4 extends RAFContainer } // Wait till other concurrent threads hit the wall - // (ClosedChannelException) and are a ready wait for us to clean up, so - // we can set them loose when we're done. + // (ClosedChannelException) and are a ready waiting for us to clean up, + // so we can set them loose when we're done. + int retries = MAX_INTERRUPT_RETRIES; + while (true) { synchronized (channelCleanupMonitor) { if (threadsInPageIO == 0) { @@ -831,8 +833,13 @@ class RAFContainer4 extends RAFContainer } } + if (retries-- == 0) { + throw StandardException.newException( + SQLState.FILE_IO_INTERRUPTED); + } + try { - Thread.sleep(10); + Thread.sleep(INTERRUPT_RETRY_SLEEP); } catch (InterruptedException te) { InterruptStatus.setInterrupted(); }