RATIS-2418. NettyClient LoggingHandler prints too many messages.#1359
RATIS-2418. NettyClient LoggingHandler prints too many messages.#1359szetszwo merged 3 commits intoapache:masterfrom
Conversation
|
@szetszwo Could you please take a look and share your feedback when you have a moment? Thanks a lot! |
|
TestRaftAsyncWithNetty.testWithLoad(..) failed with NPE: |
@szetszwo Thanks for your message—I’ll follow up on this. |
|
When the callId is not found in replies, we probably should just ignore it but not failing. +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java
@@ -157,6 +157,9 @@ public class NettyRpcProxy implements Closeable {
protected void channelRead0(ChannelHandlerContext ctx,
RaftNettyServerReplyProto proto) {
final CompletableFuture<RaftNettyServerReplyProto> future = getReplyFuture(getCallId(proto), null);
+ if (future == null) {
+ return;
+ }
if (proto.getRaftNettyServerReplyCase() == EXCEPTIONREPLY) {
final Object ioe = ProtoUtils.toObject(proto.getExceptionReply().getException());
future.completeExceptionally((IOException)ioe);
@@ -199,7 +202,6 @@ public class NettyRpcProxy implements Closeable {
private CompletableFuture<RaftNettyServerReplyProto> getReplyFuture(long callId,
CompletableFuture<RaftNettyServerReplyProto> expected) {
final CompletableFuture<RaftNettyServerReplyProto> removed = replies.remove(callId);
- Objects.requireNonNull(removed, () -> "Request #" + callId + " not found");
if (expected != null) {
Preconditions.assertSame(expected, removed, "removed");
} |
96eff6a to
201a582
Compare
|
@szetszwo I’m still working on pinpointing the root cause of this issue. So far, I haven’t been able to reproduce it in my local environment, so I’ll need a bit more time to continue investigating and validating. I’ll push this forward as quickly as possible and will update here as soon as I have any progress. |
@szetszwo Thank you for helping review the code. I think I've identified the root cause ( Root Cause
Fix Applied |
szetszwo
left a comment
There was a problem hiding this comment.
@slfan1989 , thanks a lot for digging out the bug! You are right that we must put the future first.
+1 the change looks good.
What changes were proposed in this pull request?
This PR reduces test log noise by adjusting logging levels and making logging more selective:
NettyRpcProxy.java: ChangedLoggingHandlerfromLogLevel.WARNtoLogLevel.DEBUGwith explanatory comment, since it emits all Netty pipeline events at the chosen level.TestRaftAsyncWithNetty.java: Override base class DEBUG settings by raisingRaftServer.DivisionandRaftClientlog levels back to INFO to reduce verbose test output.testWithLoadTimer to only print cluster/client state when no progress is detected (moved logs into the "no progress" branch)10seconds (starting after 5 seconds)no progressis detectedNo progressdefinition: lastStep remains unchanged between consecutive Timer checks (10-second interval){}) for better performance and consistencyWhat is the link to the Apache JIRA
JIRA: RATIS-2418. NettyClient LoggingHandler prints too many messages.
How was this patch tested?
Existing unit tests.