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

anmolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


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

commit 3c5e973d196e3ca2dbad2580667d60bac3c1b57e
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
---
 .../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 6f6578744..5198e91c1 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;
@@ -107,7 +107,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