This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch branch-3.9
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.9 by this push:
     new 306d84bdc ZOOKEEPER-5044: NettyServerCnxnFactory.shutdown must 
explicitly shut down DefaultEventExecutor
306d84bdc is described below

commit 306d84bdc5f8a655b0ea163f05f1ed32c075c126
Author: Benedict Jin <[email protected]>
AuthorDate: Fri Sep 4 02:32:11 2026 +0800

    ZOOKEEPER-5044: NettyServerCnxnFactory.shutdown must explicitly shut down 
DefaultEventExecutor
    
    Reviewers: kezhuw, anmolnar
    Author: asdf2014
    Closes #2421 from asdf2014/ZOOKEEPER-5044
    
    (cherry picked from commit 3c5e973d196e3ca2dbad2580667d60bac3c1b57e)
    Signed-off-by: Andor Molnar <[email protected]>
---
 .../java/org/apache/zookeeper/server/NettyServerCnxnFactory.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java
 
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java
index e6b0fac2a..cc8dc6f6d 100644
--- 
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java
+++ 
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java
@@ -41,9 +41,9 @@
 import io.netty.handler.ssl.SslHandler;
 import io.netty.util.AttributeKey;
 import io.netty.util.ReferenceCountUtil;
-import io.netty.util.concurrent.DefaultEventExecutor;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
+import io.netty.util.concurrent.GlobalEventExecutor;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -106,7 +106,10 @@ public void setOutstandingHandshakeLimit(int limit) {
 
     private final ServerBootstrap bootstrap;
     private Channel parentChannel;
-    private final ChannelGroup allChannels = new 
DefaultChannelGroup("zkServerCnxns", new DefaultEventExecutor());
+    // GlobalEventExecutor's shared thread starts on demand and stops itself 
when idle,
+    // so unlike a dedicated DefaultEventExecutor it needs no explicit 
shutdown to avoid
+    // leaking a non-daemon thread on factory shutdown (ZOOKEEPER-5044).
+    private final ChannelGroup allChannels = new 
DefaultChannelGroup("zkServerCnxns", GlobalEventExecutor.INSTANCE);
     private final Map<InetAddress, AtomicInteger> ipMap = new 
ConcurrentHashMap<>();
     private InetSocketAddress localAddress;
     private int maxClientCnxns = 60;

Reply via email to