Skip to content

Commit 2487cd0

Browse files
committed
gRPC: Ignore already closed exception if server is already closed
1 parent 9f1f9ca commit 2487cd0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/exc/DefaultExceptionHandlerProvider.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ public DefaultExceptionHandler(ServerCall.Listener<ReqT> listener, ServerCall<Re
5858
protected void handleException(Throwable exception, ServerCall<ReqT, RespT> call, Metadata metadata) {
5959
StatusException se = (StatusException) toStatusException(authExceptionHandlerProvider, exception);
6060
Metadata trailers = se.getTrailers() != null ? se.getTrailers() : metadata;
61-
call.close(se.getStatus(), trailers);
61+
try {
62+
call.close(se.getStatus(), trailers);
63+
} catch (IllegalStateException ise) {
64+
// Ignore the exception if the server is already closed
65+
// Since we don't have a specific exception type for this case, we need to check the message
66+
if (!"Already closed".equals(ise.getMessage())) {
67+
throw ise;
68+
}
69+
}
6270
}
6371
}
6472
}

0 commit comments

Comments
 (0)