You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by wi...@apache.org on 2023/03/06 08:03:49 UTC
[ratis] branch master updated: RATIS-1802. GrpcServerProtocolService encounters IllegalStateException: call already closed. (#839)
This is an automated email from the ASF dual-hosted git repository.
williamsong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 8a4d60c4f RATIS-1802. GrpcServerProtocolService encounters IllegalStateException: call already closed. (#839)
8a4d60c4f is described below
commit 8a4d60c4f3e1d69ade974c4705384219faa62e03
Author: Tsz-Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Mon Mar 6 00:03:41 2023 -0800
RATIS-1802. GrpcServerProtocolService encounters IllegalStateException: call already closed. (#839)
---
.../java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java | 4 +++-
ratis-proto/src/main/proto/Grpc.proto | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java
index c1006696b..8a58cdd9c 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolService.java
@@ -92,7 +92,9 @@ class GrpcServerProtocolService extends RaftServerProtocolServiceImplBase {
private void handleError(Throwable e, REQUEST request) {
GrpcUtil.warn(LOG, () -> getId() + ": Failed " + op + " request " + requestToString(request), e);
- responseObserver.onError(wrapException(e, request));
+ if (isClosed.compareAndSet(false, true)) {
+ responseObserver.onError(wrapException(e, request));
+ }
}
private synchronized void handleReply(REPLY reply) {
diff --git a/ratis-proto/src/main/proto/Grpc.proto b/ratis-proto/src/main/proto/Grpc.proto
index edcd863a1..8b7a7ffa1 100644
--- a/ratis-proto/src/main/proto/Grpc.proto
+++ b/ratis-proto/src/main/proto/Grpc.proto
@@ -47,7 +47,7 @@ service RaftServerProtocolService {
returns(stream ratis.common.InstallSnapshotReplyProto) {}
rpc readIndex(ratis.common.ReadIndexRequestProto)
- returns(stream ratis.common.ReadIndexReplyProto) {}
+ returns(ratis.common.ReadIndexReplyProto) {}
}
service AdminProtocolService {