Repository: incubator-ratis
Updated Branches:
  refs/heads/master 8cac9d54f -> bc435ad49


RATIS-193. RaftClientProtocolService can close a stream twice on error. 
Contributed by Mukul Kumar Singh.


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

Branch: refs/heads/master
Commit: bc435ad49b4d81708b873005688f3dd65f3523a1
Parents: 8cac9d5
Author: Mukul Kumar Singh <[email protected]>
Authored: Thu Jan 18 14:29:15 2018 +0530
Committer: Mukul Kumar Singh <[email protected]>
Committed: Thu Jan 18 14:29:15 2018 +0530

----------------------------------------------------------------------
 .../ratis/grpc/client/RaftClientProtocolService.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/bc435ad4/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/RaftClientProtocolService.java
----------------------------------------------------------------------
diff --git 
a/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/RaftClientProtocolService.java
 
b/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/RaftClientProtocolService.java
index 1f604d8..8517bf8 100644
--- 
a/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/RaftClientProtocolService.java
+++ 
b/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/RaftClientProtocolService.java
@@ -182,10 +182,12 @@ public class RaftClientProtocolService extends 
RaftClientProtocolServiceImplBase
     }
 
     void responseError(Throwable t, Supplier<String> message) {
-      t = JavaUtils.unwrapCompletionException(t);
-      LOG.warn(name + ": Failed " + message.get(), t);
-      responseObserver.onError(RaftGrpcUtil.wrapException(t));
-      slidingWindow.close();
+      if (isClosed.compareAndSet(false, true)) {
+        t = JavaUtils.unwrapCompletionException(t);
+        LOG.debug(name + ": Failed " + message.get(), t);
+        responseObserver.onError(RaftGrpcUtil.wrapException(t));
+        slidingWindow.close();
+      }
     }
   }
 }
\ No newline at end of file

Reply via email to