You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2013/07/18 19:02:13 UTC

svn commit: r1504528 - /hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java

Author: stack
Date: Thu Jul 18 17:02:13 2013
New Revision: 1504528

URL: http://svn.apache.org/r1504528
Log:
HBASE-8979 JVMClusterUtil will join forever on a stuck regionserver <--- zombie maker

Modified:
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java?rev=1504528&r1=1504527&r2=1504528&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java (original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java Thu Jul 18 17:02:13 2013
@@ -251,16 +251,17 @@ public class JVMClusterUtil {
 
     }
     boolean wasInterrupted = false;
-    final long maxTime = System.currentTimeMillis() + 120 * 1000;
+    final long maxTime = System.currentTimeMillis() + 30 * 1000;
     if (regionservers != null) {
       // first try nicely.
       for (RegionServerThread t : regionservers) {
         t.getRegionServer().stop("Shutdown requested");
       }
       for (RegionServerThread t : regionservers) {
-        if (t.isAlive() && !wasInterrupted && System.currentTimeMillis() < maxTime) {
+        long now = System.currentTimeMillis();
+        if (t.isAlive() && !wasInterrupted && now < maxTime) {
           try {
-            t.join(maxTime);
+            t.join(maxTime - now);
           } catch (InterruptedException e) {
             LOG.info("Got InterruptedException on shutdown - " +
                 "not waiting anymore on region server ends", e);
@@ -270,17 +271,20 @@ public class JVMClusterUtil {
       }
 
       // Let's try to interrupt the remaining threads if any.
-      for (int i = 0; i < 10; ++i) {
+      for (int i = 0; i < 100; ++i) {
+        boolean atLeastOneLiveServer = false;
         for (RegionServerThread t : regionservers) {
           if (t.isAlive()) {
+            atLeastOneLiveServer = true;
             try {
               LOG.warn("RegionServerThreads remaining, give one more chance before interrupting");
-              t.join(10);
+              t.join(1000);
             } catch (InterruptedException e) {
               wasInterrupted = true;
             }
           }
         }
+        if (!atLeastOneLiveServer) break;
         for (RegionServerThread t : regionservers) {
           if (t.isAlive()) {
             LOG.warn("RegionServerThreads taking too long to stop, interrupting");