netstat -ano输出中的ESTABLISHED off
今天,我们性能测试的环境出现个奇怪现象,通过oci direct load回库的进程似乎僵死了,应用端cpu 200%(两个线程在跑,一个是一直在ocidirectload没反应,另外一个是正在sem_trywait),如下:
oracle服务器端从一开始收到请求并执行完成之后,就没有反应了,也没有等待事件,session状态为inactive(这没有任何副作用),ash中在此之后就没有这个session的任何记录了,多个分库都是一样的现象(比较坑的是,这个动态库是我们研发中心开发的,代码不open)。
目前问题还没有时间查,主要怀疑可能是表空间满,今天又出来了,不同的位置,但是内部都是在调用oci direct load的逻辑没有正常返回结果码的问题,经测试,不是这个问题。今天的异常如下:
继续查看了各服务器到数据库的网络连接状态,oracle服务器节点都是keepalived。但是应用端为off,如下:
输出各列的含义如下:
以前都是等待超时之类的,off的状态网上介绍也比较少。它是通过-o选项出来的,也就是网络计时器。经仔细查找,off的含义如下:
keepalive
- when the keepalive timer is ON for the socketon
- when the retransmission timer is ON for the socketoff
- none of the above is ON
如上述所示,Recv-Q Send-Q 都是0。man也没有写timer的含义。所以这个问题基本上推测就在Timer身上。ss上可以看到非establish off状态的很多连接上也可能有定时器,如下:
timer列的定义为:
timer:(<timer_name>,<expire_time>,<retrans>)
timer:(keepalive,30sec,0)
共有五种类型的tcp timer,如下:
- on : means one of these timers: TCP retrans timer(也称为Time out timer), TCP early retrans timer and tail loss probe timer
- keepalive: tcp keep alive timer,默认为7200秒,超过后会每隔75秒发送10次探测,超过后服务器会关闭连接。用于识别死连接,其机制为When a TCP connection on a routing device is idle for too long, the device sends a TCP keepalive packet to the peer with only the Acknowledgment (ACK) flag turned on. If a response packet (a TCP ACK packet) is not received after the device sends a specific number of probes, the connection is considered dead and the device initiating the probes frees resources used by the TCP connection.。
- timewait: timewait stage timer
- persist: zero window probe timer
- unknown: none of the above timers
连接状态转换图(它们都可以体现在netstat中)如下:
参考:
https://superuser.com/questions/240456/how-to-interpret-the-output-of-netstat-o-netstat-timers
https://github.com/netty/netty/issues/7292
https://dashdash.io/8/ss 作为nestat的代替品出现,包含了比netstat更多的信息。
windows/linux/aix各平台keepalive优化(默认值通常不合理) https://www.veritas.com/support/en_US/article.100028680
TCP Keepalive Timer相关的参考,https://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!