You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/07/12 14:52:03 UTC

[1/2] tinkerpop git commit: TINKERPOP-1999 Prevented java driver from hanging on disorderly server shutdown

Repository: tinkerpop
Updated Branches:
  refs/heads/tp33 bf07f13b5 -> a6ba2d5b2


TINKERPOP-1999 Prevented java driver from hanging on disorderly server shutdown

We didn't see this before because all tests had assumed an orderly shutdown. In orderly shutdown the server actually manages to send a kill message which the driver respects. In disorderly shutdown, the channel just goes inactive and as described in TINKERPOP-1999 that event was not being handled properly on the driver causing it to hang. I tried to write a test for this but was unable to as I can't figure out how to write an "disorderly shutdown" which basically involves "pulling the plug" on the server. CTR


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

Branch: refs/heads/tp33
Commit: 3dcabd4f1b23fecde28c79a10502ad562d934c8d
Parents: b0c836b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:07:04 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:07:04 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../java/org/apache/tinkerpop/gremlin/driver/Handler.java    | 8 ++++++++
 .../gremlin/driver/handler/WebSocketClientHandler.java       | 5 -----
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ee49c09..a25e7a5 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-10]]
 === TinkerPop 3.2.10 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Fixed bug in Java driver where an disorderly shutdown of the server would cause the client to hang.
 * Added a dotnet template project that should make it easier to get started with Gremlin.Net.
 * Removed `ThreadInterruptCustomizerProvider` from documentation as a way to timeout.
 * Added Docker images for Gremlin Console and Gremlin Server.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
index 1bd0a3b..a6528b2 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
@@ -201,6 +201,14 @@ final class Handler {
         }
 
         @Override
+        public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
+            // occurs when the server shutsdown in a disorderly fashion, otherwise in an orderly shutdown the server
+            // should fire off a close message which will properly release the driver.
+            super.channelInactive(ctx);
+            throw new IllegalStateException("Connection to server is no longer active");
+        }
+
+        @Override
         protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception {
             try {
                 final ResponseStatusCode statusCode = response.getStatus().getCode();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
index 0a1f2f7..7b5858b 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
@@ -62,11 +62,6 @@ public final class WebSocketClientHandler extends SimpleChannelInboundHandler<Ob
     }
 
     @Override
-    public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
-        //System.out.println("WebSocket Client disconnected!");
-    }
-
-    @Override
     protected void channelRead0(final ChannelHandlerContext ctx, final Object msg) throws Exception {
         final Channel ch = ctx.channel();
         if (!handshaker.isHandshakeComplete()) {


[2/2] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/tp33
Commit: a6ba2d5b225de0cba79370774bc211d572516bfc
Parents: bf07f13 3dcabd4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:51:23 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:51:23 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../java/org/apache/tinkerpop/gremlin/driver/Handler.java    | 8 ++++++++
 .../gremlin/driver/handler/WebSocketClientHandler.java       | 5 -----
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a6ba2d5b/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a6ba2d5b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
----------------------------------------------------------------------