简体   繁体   English

许多TIME_WAIT无法建立ESTABLISHED TCP连接

[英]Many TIME_WAIT cant get ESTABLISHED tcp connection

I've got recently update system, and can't refresh context. 我最近有更新系统,并且无法刷新上下文。 It happens about 5 minutes after starting up Application Server, a tail of errors has 在启动Application Server大约5分钟后,出现了一系列错误

  "Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]"

Then debugging Application Server or in other words a client of tcp-model. 然后调试Application Server或换句话说,调试tcp-model的客户端。

netstat -a |grep 10.0.17.1|grep ESTABLISH 

shows port every time when stop debugging (about 3 items, must be more than 10), this ports keep established only if debug process stops at break point of a callback. 每次停止调试时显示端口(大约3个项,必须大于10),仅当调试过程在回调的中断点停止时,此端口才保持建立状态。 In other hand there is dozens TIME_WAIT connections during refreshing.I've found a recommendation in http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html where tcp-client should reuse connections and make them not rapidly. 另一方面,刷新期间有数十个TIME_WAIT连接。我在http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-中找到了一条建议and-scalable-servers.html tcp-client应该在其中重新使用连接并使它们不迅速。 The last one can be achieved by other database client. 最后一个可以由其他数据库客户端实现。 When open a new session, a tcp-connection is successfully ESTABLISHED and is kept as long as desire. 当打开新会话时,将成功建立tcp连接,并保持所需的时间。 For a short long life session tcp dump is 对于短暂的长寿命会话,tcp dump是

16:43:31.979499 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [S], seq 1105714340, win 29200, options [mss 1460,sackOK,TS val 4018590 ecr 0,nop,wscale 7], length 0
16:43:32.086237 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [S.], seq 1725221078, ack 1105714341, win 8192, options [mss 1410,nop,wscale 8,sackOK,TS val 1475034648 ecr 4018590], length 0
16:43:32.086281 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], ack 1, win 229, options [nop,nop,TS val 4018697 ecr 1475034648], length 0
16:43:32.086954 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 1:228, ack 1, win 229, options [nop,nop,TS val 4018698 ecr 1475034648], length 227
16:43:32.166135 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 1:9, ack 228, win 1026, options [nop,nop,TS val 1475034758 ecr 4018698], length 8
16:43:32.166192 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], ack 9, win 229, options [nop,nop,TS val 4018777 ecr 1475034758], length 0
16:43:32.166733 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 228:455, ack 9, win 229, options [nop,nop,TS val 4018777 ecr 1475034758], length 227
16:43:32.237317 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 9:41, ack 455, win 1025, options [nop,nop,TS val 1475034836 ecr 4018777], length 32
16:43:32.237604 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 455:614, ack 41, win 229, options [nop,nop,TS val 4018848 ecr 1475034836], length 159
16:43:32.311783 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 41:168, ack 614, win 1025, options [nop,nop,TS val 1475034909 ecr 4018848], length 127
16:43:32.312084 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 614:647, ack 168, win 229, options [nop,nop,TS val 4018923 ecr 1475034909], length 33
16:43:32.383071 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 168:407, ack 647, win 1025, options [nop,nop,TS val 1475034982 ecr 4018923], length 239
16:43:32.383744 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], seq 647:2045, ack 407, win 237, options [nop,nop,TS val 4018995 ecr 1475034982], length 1398
16:43:32.386640 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 2045:3232, ack 407, win 237, options [nop,nop,TS val 4018997 ecr 1475034982], length 1187
16:43:32.456443 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [.], ack 3232, win 1026, options [nop,nop,TS val 1475035056 ecr 4018995], length 0
16:43:32.457266 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [.], seq 407:1805, ack 3232, win 1026, options [nop,nop,TS val 1475035056 ecr 4018995], length 1398
16:43:32.458307 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 1805:2756, ack 3232, win 1026, options [nop,nop,TS val 1475035056 ecr 4018995], length 951
16:43:32.458402 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], ack 2756, win 281, options [nop,nop,TS val 4019069 ecr 1475035056], length 0
16:43:32.459388 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 3232:3399, ack 2756, win 281, options [nop,nop,TS val 4019070 ecr 1475035056], length 167
16:43:32.531250 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 2756:3022, ack 3399, win 1026, options [nop,nop,TS val 1475035130 ecr 4019070], length 266
16:43:32.532638 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 3399:4371, ack 3022, win 303, options [nop,nop,TS val 4019143 ecr 1475035130], length 972
16:43:32.616867 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 3022:3033, ack 4371, win 1022, options [nop,nop,TS val 1475035216 ecr 4019143], length 11
16:43:32.616899 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 3033:3044, ack 4371, win 1022, options [nop,nop,TS val 1475035216 ecr 4019143], length 11
16:43:32.616962 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], ack 3044, win 303, options [nop,nop,TS val 4019228 ecr 1475035216], length 0
16:43:32.617114 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 4371:4382, ack 3044, win 303, options [nop,nop,TS val 4019228 ecr 1475035216], length 11
16:43:32.688983 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [P.], seq 3044:3175, ack 4382, win 1022, options [nop,nop,TS val 1475035286 ecr 4019228], length 131
16:43:32.689413 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [P.], seq 4382:4392, ack 3175, win 325, options [nop,nop,TS val 4019300 ecr 1475035286], length 10
16:43:32.689465 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [F.], seq 4392, ack 3175, win 325, options [nop,nop,TS val 4019300 ecr 1475035286], length 0
16:43:32.758818 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [.], ack 4393, win 1022, options [nop,nop,TS val 1475035358 ecr 4019300], length 0
16:43:32.758874 IP 10.0.17.1.1521 > 192.168.88.246.39106: Flags [F.], seq 3175, ack 4393, win 1022, options [nop,nop,TS val 1475035358 ecr 4019300], length 0
16:43:32.758908 IP 192.168.88.246.39106 > 10.0.17.1.1521: Flags [.], ack 3176, win 325, options [nop,nop,TS val 4019370 ecr 1475035358], length 0

The main thing that the session from Spring keeps alive less than 1 second. 来自Spring的会话保持存活的主要时间不到1秒。 There is no problem with opening ports and no problem with manually created database connection from other client as mentioned above. 如上所述,打开端口没有问题,从其他客户端手动创建的数据库连接也没有问题。

Very, very need to discuss the issue!!!

Solve problem by merging backup /etc directory. 通过合并备份/ etc目录来解决问题。 The issue was in Linux. 问题出在Linux中。 By comparing with nonworking case found that /proc/sys/net consists netfilter parameters. 通过与不工作的情况进行比较,发现/ proc / sys / net包含netfilter参数。 I'm not an expert in netfiltering so just try to avoid it. 我不是netfiltering的专家,所以请尽量避免使用它。 Before merging tried to remove some nf_* modules from kernel without success, no way to remove nf_conntrack module even with force key or blacklisting. 合并之前,尝试从内核中删除某些nf_ *模块没有成功,即使使用强制密钥或列入黑名单,也无法删除nf_conntrack模块。 Fortunately no need to rebuild kernel just merging /etc. 幸运的是,仅需合并/ etc即可无需重建内核。 The only thing that is different after merging is files mode, which kdiff3 doesn't show. 合并后唯一不同的是文件模式,kdiff3不会显示。 Keeping entire one million possible solutions! 保留整个一百万种可能的解决方案!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM