wenbingshen commented on code in PR #4762:
URL: https://github.com/apache/bookkeeper/pull/4762#discussion_r3152721401


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java:
##########
@@ -316,13 +318,37 @@ private void listenOn(InetSocketAddress address, 
BookieSocketAddress bookieAddre
             bootstrap.childOption(ChannelOption.ALLOCATOR, allocator);
             bootstrap.group(acceptorGroup, eventLoopGroup);
             bootstrap.childOption(ChannelOption.TCP_NODELAY, 
conf.getServerTcpNoDelay());
+            bootstrap.childOption(ChannelOption.SO_KEEPALIVE, 
conf.getServerSockKeepalive());
             bootstrap.childOption(ChannelOption.SO_LINGER, 
conf.getServerSockLinger());
             bootstrap.childOption(ChannelOption.RCVBUF_ALLOCATOR,
                     new 
AdaptiveRecvByteBufAllocator(conf.getRecvByteBufAllocatorSizeMin(),
                             conf.getRecvByteBufAllocatorSizeInitial(), 
conf.getRecvByteBufAllocatorSizeMax()));
             bootstrap.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new 
WriteBufferWaterMark(
                     conf.getServerWriteBufferLowWaterMark(), 
conf.getServerWriteBufferHighWaterMark()));
 
+            // Set TCP keepalive parameters if configured
+            if (EventLoopUtil.isIoUringGroup(eventLoopGroup)) {
+                if (conf.getServerTcpKeepIdle() > 0) {
+                    bootstrap.option(IoUringChannelOption.TCP_KEEPIDLE, 
conf.getServerTcpKeepIdle());

Review Comment:
   `ServerBootstrap.option()` sets options on the listening 
`ServerSocketChannel`. For `TCP_KEEPIDLE/INTVL/CNT`, please use `childOption()` 
— it targets each accepted `SocketChannel` 
     directly, which is the Netty-idiomatic approach and avoids relying on 
OS-level socket option inheritance behavior. Same applies to `jvmBootstrap`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to