This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch branch-2_readIndex
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/branch-2_readIndex by this
push:
new cfd342044 RATIS-1802. GrpcServerProtocolService encounters
IllegalStateException: call already closed. (#839)
cfd342044 is described below
commit cfd34204409667ef40d72047ab3d904fa391f534
Author: Tsz-Wo Nicholas Sze <[email protected]>
AuthorDate: Mon Mar 6 00:03:41 2023 -0800
RATIS-1802. GrpcServerProtocolService encounters IllegalStateException:
call already closed. (#839)
(cherry picked from commit 8a4d60c4f3e1d69ade974c4705384219faa62e03)
---
.../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 {