tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject tajo git commit: TAJO-1965: TestBlockingRpc::testServerShutdown occassionally fails.
Date Tue, 10 Nov 2015 09:28:53 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 8ad250eb9 -> ed6603792


TAJO-1965: TestBlockingRpc::testServerShutdown occassionally fails.

Closes #849


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/ed660379
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/ed660379
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/ed660379

Branch: refs/heads/master
Commit: ed660379263add03f50fb68016c57ac40e5897a4
Parents: 8ad250e
Author: Jinho Kim <jhkim@apache.org>
Authored: Tue Nov 10 18:28:02 2015 +0900
Committer: Jinho Kim <jhkim@apache.org>
Committed: Tue Nov 10 18:28:02 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 ++
 .../org/apache/tajo/rpc/NettyServerBase.java    | 26 ++++++++++----------
 .../java/org/apache/tajo/rpc/TestAsyncRpc.java  |  6 ++---
 .../org/apache/tajo/rpc/TestBlockingRpc.java    | 15 +++++------
 .../apache/tajo/rpc/TestRpcClientManager.java   |  8 +++---
 .../rpc/test/impl/DummyProtocolAsyncImpl.java   |  2 +-
 .../test/impl/DummyProtocolBlockingImpl.java    |  2 +-
 7 files changed, 30 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 4f7d303..c36ced1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -33,6 +33,8 @@ Release 0.12.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1965: TestBlockingRpc::testServerShutdown occassionally fails. (jinho)
+
     TAJO-1882: Clean up GreedyHeuristicJoinOrderAlgorithm::getCost APIs. (jihoon)
 
     TAJO-1972: Invalid sort order with NULLS FIRST|LAST. (jihoon)

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-common/src/main/java/org/apache/tajo/rpc/NettyServerBase.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-common/src/main/java/org/apache/tajo/rpc/NettyServerBase.java
b/tajo-rpc/tajo-rpc-common/src/main/java/org/apache/tajo/rpc/NettyServerBase.java
index 258afe8..08d877f 100644
--- a/tajo-rpc/tajo-rpc-common/src/main/java/org/apache/tajo/rpc/NettyServerBase.java
+++ b/tajo-rpc/tajo-rpc-common/src/main/java/org/apache/tajo/rpc/NettyServerBase.java
@@ -143,24 +143,24 @@ public class NettyServerBase {
     
     try {
       accepted.close();
-    } catch (Throwable t) {
-      LOG.error(t.getMessage(), t);
-    }
 
-    if(bootstrap != null) {
-      if (bootstrap.childGroup() != null) {
-        bootstrap.childGroup().shutdownGracefully();
-        if (waitUntilThreadsStop) {
-          bootstrap.childGroup().terminationFuture().awaitUninterruptibly();
+      if(bootstrap != null) {
+        if (bootstrap.childGroup() != null) {
+          bootstrap.childGroup().shutdownGracefully();
+          if (waitUntilThreadsStop) {
+            bootstrap.childGroup().terminationFuture().sync();
+          }
         }
-      }
 
-      if (bootstrap.group() != null) {
-        bootstrap.group().shutdownGracefully();
-        if (waitUntilThreadsStop) {
-          bootstrap.childGroup().terminationFuture().awaitUninterruptibly();
+        if (bootstrap.group() != null) {
+          bootstrap.group().shutdownGracefully();
+          if (waitUntilThreadsStop) {
+            bootstrap.childGroup().terminationFuture().sync();
+          }
         }
       }
+    } catch (Throwable t) {
+      LOG.error(t.getMessage(), t);
     }
     
     for (RpcEventListener listener: listeners) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
index 6427ffe..1acfe40 100644
--- a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
+++ b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestAsyncRpc.java
@@ -151,7 +151,7 @@ public class TestAsyncRpc {
 
   public void tearDownRpcServer() throws Exception {
     if (server != null) {
-      server.shutdown();
+      server.shutdown(true);
       server = null;
     }
   }
@@ -370,7 +370,7 @@ public class TestAsyncRpc {
     assertEquals(echoMessage, future.get());
     assertTrue(future.isDone());
     client.close();
-    server.shutdown();
+    server.shutdown(true);
   }
 
 
@@ -603,7 +603,7 @@ public class TestAsyncRpc {
     EchoMessage echoMessage = EchoMessage.newBuilder()
         .setMessage(MESSAGE).build();
     CallFuture<EchoMessage> future = new CallFuture<>();
-    stub.busy(future.getController(), echoMessage, future); //30 sec delay
+    stub.busy(future.getController(), echoMessage, future); //10 sec delay
     assertFalse(future.isDone());
 
     EchoMessage result = null;

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
index 0687d0b..08ab887 100644
--- a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
+++ b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestBlockingRpc.java
@@ -141,7 +141,7 @@ public class TestBlockingRpc {
 
   public void tearDownRpcServer() throws Exception {
     if (server != null) {
-      server.shutdown();
+      server.shutdown(true);
       server = null;
     }
   }
@@ -245,7 +245,7 @@ public class TestBlockingRpc {
     assertTrue(expect);
   }
 
-  @Test
+  @Test(timeout = 60000)
   public void testServerShutdown3() throws Exception {
     final StringBuilder error = new StringBuilder();
     Thread callThread = new Thread() {
@@ -274,8 +274,7 @@ public class TestBlockingRpc {
         } catch (InterruptedException e) {
         }
         try {
-          server.shutdown();
-          server = null;
+          server.shutdown(true);
           latch.countDown();
         } catch (Throwable e) {
           e.printStackTrace();
@@ -284,9 +283,7 @@ public class TestBlockingRpc {
     };
     shutdownThread.start();
 
-    assertTrue(latch.await(5 * 1000, TimeUnit.MILLISECONDS));
-
-    assertTrue(latch.getCount() == 0);
+    latch.await();
 
     synchronized (error) {
       error.wait(5 * 1000);
@@ -336,7 +333,7 @@ public class TestBlockingRpc {
     EchoMessage response = stub.echo(null, message);
     assertEquals(MESSAGE, response.getMessage());
     client.close();
-    server.shutdown();
+    server.shutdown(true);
   }
 
   @Test(timeout = 60000)
@@ -558,7 +555,7 @@ public class TestBlockingRpc {
 
     boolean expected = false;
     try {
-      EchoMessage message = stub.busy(null, echoMessage); //30 sec delay
+      EchoMessage message = stub.busy(null, echoMessage); //10 sec delay
       fail();
     } catch (TajoServiceException e) {
       expected = true;

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestRpcClientManager.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestRpcClientManager.java
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestRpcClientManager.java
index 160c6a3..865e5dd 100644
--- a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestRpcClientManager.java
+++ b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/TestRpcClientManager.java
@@ -71,7 +71,7 @@ public class TestRpcClientManager {
       NettyClientBase clientBase = manager.getClient(address, DummyProtocol.class, false,
new Properties());
       RpcClientManager.cleanup(clientBase);
     } finally {
-      server.shutdown();
+      server.shutdown(true);
       executor.shutdown();
       RpcClientManager.close();
     }
@@ -97,7 +97,7 @@ public class TestRpcClientManager {
       client.close();
       assertFalse(RpcClientManager.contains(key));
     } finally {
-      server.shutdown();
+      server.shutdown(true);
       RpcClientManager.close();
     }
   }
@@ -133,7 +133,7 @@ public class TestRpcClientManager {
         assertFalse(RpcClientManager.contains(key));
       }
     } finally {
-      server.shutdown();
+      server.shutdown(true);
       RpcClientManager.close();
     }
   }
@@ -172,7 +172,7 @@ public class TestRpcClientManager {
 
       RpcClientManager.cleanup(client1, client2);
     } finally {
-      server.shutdown();
+      server.shutdown(true);
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolAsyncImpl.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolAsyncImpl.java
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolAsyncImpl.java
index abcc057..e1ea58e 100644
--- a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolAsyncImpl.java
+++ b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolAsyncImpl.java
@@ -83,7 +83,7 @@ public class DummyProtocolAsyncImpl implements Interface {
   public void busy(RpcController controller, EchoMessage request,
                    RpcCallback<EchoMessage> done) {
     try {
-      Thread.sleep(30000);
+      Thread.sleep(10000);
     } catch (InterruptedException e) {
       LOG.error(e.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/ed660379/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolBlockingImpl.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolBlockingImpl.java
b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolBlockingImpl.java
index 40eb18f..d37d07e 100644
--- a/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolBlockingImpl.java
+++ b/tajo-rpc/tajo-rpc-protobuf/src/test/java/org/apache/tajo/rpc/test/impl/DummyProtocolBlockingImpl.java
@@ -79,7 +79,7 @@ public class DummyProtocolBlockingImpl implements BlockingInterface {
   @Override
   public EchoMessage busy(RpcController controller, EchoMessage request) {
     try {
-      Thread.sleep(30000);
+      Thread.sleep(10000);
     } catch (InterruptedException e) {
       LOG.error(e.getMessage());
     }


Mime
View raw message