gpt4 book ai didi

java - 许多 TIME_WAIT 无法获得 ESTABLISHED tcp 连接

转载 作者:太空宇宙 更新时间:2023-11-04 11:56:54 26 4
gpt4 key购买 nike

我最近更新了系统,无法刷新上下文。 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]"

然后调试 Application Server 或者换句话说就是 tcp-model 的客户端。

netstat -a |grep 10.0.17.1|grep ESTABLISH 

每次停止调试时显示端口(大约3项,必须大于10),只有当调试过程停止在回调的断点时,这个端 Eloquent 会保持建立。另一方面,在刷新过程中有几十个 TIME_WAIT 连接。我在 http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html 中找到了一个建议,其中 tcp-client 应该重用连接并使它们不那么快。最后一个可以通过其他数据库客户端来实现。当打开一个新的 session 时,一个 tcp 连接被成功地建立起来,并且只要需要就可以保持。对于短暂的长期 session tcp 转储是

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

主要是 Spring 的 session 保持 Activity 状态不到 1 秒。打开端口没有问题,从其他客户端手动创建数据库连接也没有问题。

Very, very need to discuss the issue!!!

最佳答案

通过合并备份/etc 目录解决问题。问题出在 Linux 中。通过与非工作情况的比较发现/proc/sys/net 包含netfilter 参数。我不是 netfiltering 方面的专家,所以尽量避免使用它。在合并之前尝试从内核中删除一些 nf_* 模块但没有成功,即使使用强制键或黑名单也无法删除 nf_conntrack 模块。幸运的是,只需合并/etc 就无需重建内核。合并后唯一不同的是文件模式,kdiff3 没有显示。保持一百万个可能的解决方案!

关于java - 许多 TIME_WAIT 无法获得 ESTABLISHED tcp 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53961560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com