We're seeing TCP/IP warning and quite a few connection failures on our web and SQL server (Win 2008 SP1 with IPv6 enabled) and it happens more often when the worker process/SQL server process has been running for a couple of days continuously. I am wondering what causes these warnings? What is the default number of TCP connections allowed and how can we bump this up?
我们在Web和SQL服务器(启用了IPv6的Win 2008 SP1)上看到TCP / IP警告和相当多的连接失败,当工作进程/ SQL服务器进程连续运行几天时,它会更频繁地发生。我想知道导致这些警告的原因是什么?允许的TCP连接的默认数量是多少?我们如何将其提升?
TCP/IP failed to establish an outgoing connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outgoing connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outgoing connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.
TCP / IP无法建立传出连接,因为最近使用所选本地端点连接到同一远程端点。当以高速率打开和关闭传出连接时,通常会发生此错误,从而导致使用所有可用的本地端口,并强制TCP / IP重用本地端口以进行传出连接。为了最大限度地降低数据损坏的风险,TCP / IP标准要求从给定本地端点到给定远程端点的连续连接之间经过最短时间。
4 个解决方案
#1
It sounds kinda like your connections start failing and then are automatically retried. If the retries happen quickly enough TCP could cycle through the entire port range and all your ports will be in TIME-WAIT state (IIRC that's what the state's called, it's been a little while since I've been debugging TCP in detail).
这听起来有点像你的连接开始失败然后自动重试。如果重试发生得足够快,TCP可以在整个端口范围内循环,并且所有端口都处于TIME-WAIT状态(IIRC就是状态所谓的状态,自从我详细调试TCP以来已经有一段时间了)。
A couple of things to understand first:
首先要了解的几件事:
- Who is originating the connection(s) and what are they supposed to be used for?
- Verify the connection failure rates, I tend to use Wireshark for this sort of thing.
谁发起了连接以及它们应该用于什么?
验证连接失败率,我倾向于使用Wireshark来做这类事情。
Then you have to look for clues as to why the connection is failing. Probably the outgoing connection is to a server, is the server up and running? Why wouldn't the server accept the connection - is the process/thread responsible for accepting the connection deadlocked, blocked on something, or has it exited? Is the network between the originator and the server working normally?
然后你必须找到关于连接失败的原因的线索。传出连接可能是服务器,服务器是否正常运行?为什么服务器不接受连接 - 进程/线程负责接受死锁,阻塞某些内容或退出连接?发起者和服务器之间的网络是否正常工作?
#3
are you using something like
你在用类似的东西吗?
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)
it allows you to reuse the same socket twice without warning
它允许您重复使用相同的套接字两次而不会发出警告
#4
This looks to me like exactly what the error message suggests... your ports are being exhausted. This implies a LOT of outgoing connections.
这看起来就像错误消息所暗示的那样...您的端口正在耗尽。这意味着有很多传出连接。
The default is not to limit the number of tcp connections (I suppose you're only limited by the number of ports, probably ports 1024 to 65534)
默认情况下不限制tcp连接数(我想你只受端口数限制,可能是端口1024到65534)
I would begin investigating why you're seeing so many outgoing connections in such a short time.
我会开始研究为什么你会在如此短的时间内看到如此多的传出连接。
#1
It sounds kinda like your connections start failing and then are automatically retried. If the retries happen quickly enough TCP could cycle through the entire port range and all your ports will be in TIME-WAIT state (IIRC that's what the state's called, it's been a little while since I've been debugging TCP in detail).
这听起来有点像你的连接开始失败然后自动重试。如果重试发生得足够快,TCP可以在整个端口范围内循环,并且所有端口都处于TIME-WAIT状态(IIRC就是状态所谓的状态,自从我详细调试TCP以来已经有一段时间了)。
A couple of things to understand first:
首先要了解的几件事:
- Who is originating the connection(s) and what are they supposed to be used for?
- Verify the connection failure rates, I tend to use Wireshark for this sort of thing.
谁发起了连接以及它们应该用于什么?
验证连接失败率,我倾向于使用Wireshark来做这类事情。
Then you have to look for clues as to why the connection is failing. Probably the outgoing connection is to a server, is the server up and running? Why wouldn't the server accept the connection - is the process/thread responsible for accepting the connection deadlocked, blocked on something, or has it exited? Is the network between the originator and the server working normally?
然后你必须找到关于连接失败的原因的线索。传出连接可能是服务器,服务器是否正常运行?为什么服务器不接受连接 - 进程/线程负责接受死锁,阻塞某些内容或退出连接?发起者和服务器之间的网络是否正常工作?
#2
Here is the TechNet page for that error.
以下是该错误的TechNet页面。
#3
are you using something like
你在用类似的东西吗?
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)
it allows you to reuse the same socket twice without warning
它允许您重复使用相同的套接字两次而不会发出警告
#4
This looks to me like exactly what the error message suggests... your ports are being exhausted. This implies a LOT of outgoing connections.
这看起来就像错误消息所暗示的那样...您的端口正在耗尽。这意味着有很多传出连接。
The default is not to limit the number of tcp connections (I suppose you're only limited by the number of ports, probably ports 1024 to 65534)
默认情况下不限制tcp连接数(我想你只受端口数限制,可能是端口1024到65534)
I would begin investigating why you're seeing so many outgoing connections in such a short time.
我会开始研究为什么你会在如此短的时间内看到如此多的传出连接。