You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2011/04/11 23:36:03 UTC

svn commit: r1091221 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java

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();
             }