Copilot commented on code in PR #1285:
URL: https://github.com/apache/ratis/pull/1285#discussion_r2384225655
##########
ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java:
##########
@@ -121,6 +125,17 @@ protected void channelRead0(ChannelHandlerContext ctx,
future.complete(proto);
}
}
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable
cause) {
+ failOutstandingRequests(new IOException("Caught an exception for the
connection to " + peer, cause));
+ client.close();
Review Comment:
The exceptionCaught method should call super.exceptionCaught(ctx, cause) to
ensure proper exception propagation in the Netty pipeline, or at minimum call
ctx.close() to properly close the channel context.
```suggestion
client.close();
ctx.close();
```
##########
ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java:
##########
@@ -121,6 +125,17 @@ protected void channelRead0(ChannelHandlerContext ctx,
future.complete(proto);
}
}
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable
cause) {
+ failOutstandingRequests(new IOException("Caught an exception for the
connection to " + peer, cause));
+ client.close();
+ }
+
+ @Override
+ public void channelInactive(ChannelHandlerContext ctx) {
+ failOutstandingRequests(new AlreadyClosedException("Channel to " +
peer + " is inactive."));
Review Comment:
The channelInactive method should call super.channelInactive(ctx) to ensure
proper cleanup in the Netty pipeline.
```suggestion
failOutstandingRequests(new AlreadyClosedException("Channel to " +
peer + " is inactive."));
super.channelInactive(ctx);
```
--
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]