slfan1989 opened a new pull request, #1445: URL: https://github.com/apache/ratis/pull/1445
## What changes were proposed in this pull request? This pull request fixes a zero-copy request leak during gRPC service shutdown. `ZeroCopyMessageMarshaller` may still hold pending or in-flight zero-copy request streams when the gRPC service is being closed. Previously, closing these tracked streams did not trigger the release logic for the corresponding zero-copy messages, which could cause `ZeroCopyMetrics` to report unreleased messages during cluster shutdown. The proposed changes: - Release tracked zero-copy messages when `ZeroCopyMessageMarshaller.close()` is called. - Add close logic for gRPC protocol services that own zero-copy request marshallers. - Explicitly close these protocol services in `GrpcServicesImpl.closeImpl()` before unregistering zero-copy metrics. - Ensure the same `GrpcServerProtocolService` instance bound to the gRPC server is also closed during shutdown. ## What is the link to the Apache JIRA RATIS-2512. Fix unreleased zero-copy messages during gRPC service shutdown ## How was this patch tested? - This patch was tested with the following commands: ``` ./mvnw -pl ratis-test -am -Pgrpc-tests -Dtest=TestGrpcZeroCopy,TestRaftAsyncWithGrpc#testWithLoadAsync test ``` - Both tests passed successfully. ``` [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.ratis.grpc.TestRaftAsyncWithGrpc [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.141 s - in org.apache.ratis.grpc.TestRaftAsyncWithGrpc [INFO] Running org.apache.ratis.grpc.util.TestGrpcZeroCopy [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 21.272 s - in org.apache.ratis.grpc.util.TestGrpcZeroCopy [INFO] [INFO] Results: [INFO] [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
