This is an automated email from the ASF dual-hosted git repository.
hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 38e3c6a4dc [ISSUE #5047] Fix EventLoop threads leak in TCP plugin
(#5048)
38e3c6a4dc is described below
commit 38e3c6a4dce0c14cd1557d88177f723b8c77ec2f
Author: 吴伟杰 <[email protected]>
AuthorDate: Sat Aug 19 16:17:00 2023 +0800
[ISSUE #5047] Fix EventLoop threads leak in TCP plugin (#5048)
---
.../java/org/apache/shenyu/protocol/tcp/TcpBootstrapServer.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/shenyu-protocol/shenyu-protocol-tcp/src/main/java/org/apache/shenyu/protocol/tcp/TcpBootstrapServer.java
b/shenyu-protocol/shenyu-protocol-tcp/src/main/java/org/apache/shenyu/protocol/tcp/TcpBootstrapServer.java
index fc48bd33cf..05e0829b29 100644
---
a/shenyu-protocol/shenyu-protocol-tcp/src/main/java/org/apache/shenyu/protocol/tcp/TcpBootstrapServer.java
+++
b/shenyu-protocol/shenyu-protocol-tcp/src/main/java/org/apache/shenyu/protocol/tcp/TcpBootstrapServer.java
@@ -20,13 +20,12 @@ package org.apache.shenyu.protocol.tcp;
import com.google.common.eventbus.EventBus;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
-
import org.apache.shenyu.common.dto.DiscoveryUpstreamData;
+import org.apache.shenyu.protocol.tcp.connection.ActivityConnectionObserver;
import org.apache.shenyu.protocol.tcp.connection.Bridge;
import org.apache.shenyu.protocol.tcp.connection.ConnectionContext;
import
org.apache.shenyu.protocol.tcp.connection.DefaultConnectionConfigProvider;
import org.apache.shenyu.protocol.tcp.connection.TcpConnectionBridge;
-import org.apache.shenyu.protocol.tcp.connection.ActivityConnectionObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
@@ -49,6 +48,8 @@ public class TcpBootstrapServer implements BootstrapServer {
private ConnectionContext connectionContext;
+ private LoopResources loopResources;
+
private DisposableServer server;
private final EventBus eventBus;
@@ -66,7 +67,7 @@ public class TcpBootstrapServer implements BootstrapServer {
this.bridge = new TcpConnectionBridge();
connectionContext = new ConnectionContext(connectionConfigProvider);
connectionContext.init(tcpServerConfiguration.getProps());
- LoopResources loopResources =
LoopResources.create("shenyu-tcp-bootstrap-server",
Integer.parseInt(bossGroupThreadCount),
+ loopResources = LoopResources.create("shenyu-tcp-bootstrap-server-" +
tcpServerConfiguration.getPort(), Integer.parseInt(bossGroupThreadCount),
Integer.parseInt(workerGroupThreadCount), true);
TcpServer tcpServer = TcpServer.create()
.doOnChannelInit((connObserver, channel, remoteAddress) ->
channel.pipeline().addFirst(new LoggingHandler(LogLevel.INFO)))
@@ -113,6 +114,7 @@ public class TcpBootstrapServer implements BootstrapServer {
@Override
public void shutdown() {
server.disposeNow();
+ loopResources.dispose();
}
}