TINKERPOP-1999 Fixed bug introduced in previous fix to this issue The problem was introduced at 3dcabd4f1b23fecde28c79a10502ad562d934c8d - by throwing an exception on the client in channelInactive() it would trigger double reporting of exception in normal shutdowns and other odd behavior including errors in doc generation. Instead of an exception we just release pending messages which releases any blocked threads (which was the original nature of the problem this issue set out to fix). CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/0272a2e4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/0272a2e4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/0272a2e4 Branch: refs/heads/TINKERPOP-1996 Commit: 0272a2e42cd7cafaf7e51b6ef56f5cd6e5b3d691 Parents: 6c6ab32 Author: Stephen Mallette <[email protected]> Authored: Wed Jul 18 11:06:43 2018 -0400 Committer: Stephen Mallette <[email protected]> Committed: Wed Jul 18 11:06:43 2018 -0400 ---------------------------------------------------------------------- .../java/org/apache/tinkerpop/gremlin/driver/Handler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0272a2e4/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 a6528b2..b8d9078 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 @@ -205,7 +205,10 @@ final class Handler { // 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"); + + // the channel isn't going to get anymore results as it is closed so release all pending requests + pending.values().forEach(val -> val.markError(new IllegalStateException("Connection to server is no longer active"))); + pending.clear(); } @Override @@ -277,7 +280,7 @@ final class Handler { // serialization exceptions should not close the channel - that's worth a retry if (!IteratorUtils.anyMatch(ExceptionUtils.getThrowableList(cause).iterator(), t -> t instanceof SerializationException)) - ctx.close(); + if (ctx.channel().isActive()) ctx.close(); } }
