Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 85196 invoked from network); 11 Apr 2011 21:36:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Apr 2011 21:36:27 -0000 Received: (qmail 85206 invoked by uid 500); 11 Apr 2011 21:36:27 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 85182 invoked by uid 500); 11 Apr 2011 21:36:27 -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 85175 invoked by uid 99); 11 Apr 2011 21:36:26 -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 21:36:26 +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 21:36:24 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 19DD52388994; Mon, 11 Apr 2011 21:36:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1091221 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Date: Mon, 11 Apr 2011 21:36:03 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110411213603.19DD52388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dag Date: Mon Apr 11 21:36:02 2011 New Revision: 1091221 URL: http://svn.apache.org/viewvc?rev=1091221&view=rev Log: DERBY-5185 store/rollForwardRecovery.sql stuck in RAFContainer4.recoverContainerAfterInterrupt() during shutdown 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/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java?rev=1091221&r1=1091220&r2=1091221&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Mon Apr 11 21:36:02 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(); }