Closed iqinlongfei closed 10 months ago
TCP Server设置了5秒的KeepAlive时间,gnet.WithTCPKeepAlive(5*time.Second),在压测时,Client与Server大概建立了8000+条TCP连接,Client在运行中crash掉了,但Server端并没有按照设置的KeepAlive断开连接。
看了一下源码,TCP_KEEPINTVL和TCP_KEEPIDLE设置了5s,TCP_KEEPCNT没有设置,系统设置的是9。所以总的断开时间应该是5 + 5*9 = 50s。也就是说50s后,server端会断开连接。
但我抓包看,server端并没有发送keepalive,而是每隔120s进行一次重传。65.78是server,65.79是client
v2
v2.3.0
Linux
Linux 5.4.56.bsk.9-amd64 x86_64
go version go1.18.2 linux/amd64
没有设置logger
No response
I haven't verified it with the latest release
能提供一下可以复现这个问题的客户端和服务端代码吗?
代码需要整理一下,需要提取出来
最近 gnet 对 TCP Keep-Alives 设置做了以下优化: #522,可以验证一下这个问题是否存在,我先关闭 issue 了,如果还有问题可以随时重新打开这个 issue
gnet
Actions I've taken before I'm here
What happened?
TCP Server设置了5秒的KeepAlive时间,gnet.WithTCPKeepAlive(5*time.Second),在压测时,Client与Server大概建立了8000+条TCP连接,Client在运行中crash掉了,但Server端并没有按照设置的KeepAlive断开连接。
看了一下源码,TCP_KEEPINTVL和TCP_KEEPIDLE设置了5s,TCP_KEEPCNT没有设置,系统设置的是9。所以总的断开时间应该是5 + 5*9 = 50s。也就是说50s后,server端会断开连接。
但我抓包看,server端并没有发送keepalive,而是每隔120s进行一次重传。65.78是server,65.79是client
Major version of gnet
v2
Specific version of gnet
v2.3.0
Operating system
Linux
OS version
Linux 5.4.56.bsk.9-amd64 x86_64
Go version
go version go1.18.2 linux/amd64
Relevant log output
Code snippets (optional)
No response
How to Reproduce
Does this issue reproduce with the latest release?
I haven't verified it with the latest release