This is an automated email from the ASF dual-hosted git repository.
fuyou pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 4291971c03 [ISSUE #5866] fix client-side memory leak of inactive
channel (#5867)
4291971c03 is described below
commit 4291971c03611bb17cedc4a282296babd4478b3b
Author: imzs <[email protected]>
AuthorDate: Tue Jun 13 16:47:10 2023 +0800
[ISSUE #5866] fix client-side memory leak of inactive channel (#5867)
* fix #5866 Client-side memory leak of inactive channel
* also accept RemotingSendRequestException when
NettyRemotingAbstract#failFast invoked.
---------
Co-authored-by: moling <[email protected]>
---
.../org/apache/rocketmq/remoting/netty/NettyRemotingClient.java | 8 ++++++++
.../java/org/apache/rocketmq/remoting/SubRemotingServerTest.java | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
index 1853b0c45b..afd779c830 100644
---
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
+++
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
@@ -980,6 +980,14 @@ public class NettyRemotingClient extends
NettyRemotingAbstract implements Remoti
}
}
+ @Override
+ public void channelInactive(ChannelHandlerContext ctx) throws
Exception {
+ final String remoteAddress =
RemotingHelper.parseChannelRemoteAddr(ctx.channel());
+ LOGGER.info("NETTY CLIENT PIPELINE: channelInactive, the
channel[{}]", remoteAddress);
+ closeChannel(ctx.channel());
+ super.channelInactive(ctx);
+ }
+
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt)
throws Exception {
if (evt instanceof IdleStateEvent) {
diff --git
a/remoting/src/test/java/org/apache/rocketmq/remoting/SubRemotingServerTest.java
b/remoting/src/test/java/org/apache/rocketmq/remoting/SubRemotingServerTest.java
index 90fa8451fb..43ff1e9c0f 100644
---
a/remoting/src/test/java/org/apache/rocketmq/remoting/SubRemotingServerTest.java
+++
b/remoting/src/test/java/org/apache/rocketmq/remoting/SubRemotingServerTest.java
@@ -105,7 +105,7 @@ public class SubRemotingServerTest {
remotingClient.invokeSync("localhost:1234", request, 1000 * 3);
failBecauseExceptionWasNotThrown(RemotingTimeoutException.class);
} catch (Exception e) {
- assertThat(e).isInstanceOf(RemotingTimeoutException.class);
+ assertThat(e).isInstanceOfAny(RemotingTimeoutException.class,
RemotingSendRequestException.class);
}
}
}