[ https://issues.apache.org/jira/browse/KUDU-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628948#comment-17628948 ]
Bakai Ádám commented on KUDU-3387: ---------------------------------- In the commit 57dda5d4868d29f68de4aa0ac516ca390333e6be , the possibility was explored, and the timeout is enabled, but the timeout is not set: AsyncKuduClient.java:~3030 {code:java} + // Unfortunately there is no way to override the keep-alive timeout in + // Java since the JRE doesn't expose any way to call setsockopt() with + // TCP_KEEPIDLE. And of course the default timeout is >2h. Sigh. + b.option(ChannelOption.SO_KEEPALIVE, true); {code} As far as I understand netty doesn't expose the Socket itself, but since then it is possible to change the timeout interval on some platform with ExtendedSocketOptions (https://docs.oracle.com/en/java/javase/11/docs/api/jdk.net/jdk/net/ExtendedSocketOptions.html). Here is an example how to set it: https://stackoverflow.com/questions/22472844/how-to-set-socket-option-tcp-keepcnt-tcp-keepidle-tcp-keepintvl-in-java-or-n So in theory It may be possible to set options on the SocketChannel (on Mac and Linux, source: https://bugs.openjdk.org/browse/JDK-8194298) , but not with io.netty.channel.socket.nio.NioSocketChannel . These are the options that can be configured: https://javadoc.io/static/io.netty/netty-transport/5.0.0.Alpha2/io/netty/channel/socket/SocketChannelConfig.html . This is the highest version of netty I could find at the date of the comment. So, in short: the TCP keepalive is set to true already, but the timeout interval is not explicitly set, and it can be very high (2 hours). Now Java support changing the keepalive time on Mac and Linux(keep in mind the current solution is Linux-only (Socket::SetTcpKeepAlive)), but netty doesn't support it, so it can not be changed. > Enable TCP keepalive for connections created by Java client > ----------------------------------------------------------- > > Key: KUDU-3387 > URL: https://issues.apache.org/jira/browse/KUDU-3387 > Project: Kudu > Issue Type: Improvement > Components: client, java > Reporter: Alexey Serbin > Priority: Major > Labels: newbie > > https://github.com/apache/kudu/commit/89c02fded7595b4712b465bfb939e4f3035b2e75 > enabled TCP keepalive for outbound connections; and the C++ client since > then is able to detect a dropped off connection when server didn't send a TCP > RST. > It's would be great to enable TCP keepalive for connections created by Java > client as well. -- This message was sent by Atlassian Jira (v8.20.10#820010)