You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The total of live TCP connections is limited on operation system.

In your java application, if you experience java.net.SocketException: No buffer space available (maximum connections reached?), then you should check which process on the machine is consuming the resource.

First check the total connections on the machine, (execute the command in PowerShell)

netstat -anop tcp | measure

It will output the total count, we think that is normal if the total count is less than 200.

you can check the connection details

netstat -anop tcp

If one process (last column is the process ID) is hogging the connections, (in the following example 1696 is the process ID, you need to change it accordingly)

netstat -anop tcp | find `"1696`" | measure

Generally, in netstat output, you could see these TCP connection status, ESTABLISHED, TIME_WAIT, CLOSE_WAIT. If you wan to see the total connections established  by the specified process

netstat -anop tcp | find `"1696`" | find `"ESTABLISHED`" | measure


With our knowledge, if the SocketException happens, then it must have huge amount of CLOSE_WAIT connections

netstat -anop tcp | find `"1696`" | find `"CLOSE_WAIT`" | measure


You may need to run these commands on daily base. If you see an obvious accumulation on total connections, especially on CLOSE_WAIT connections, please contact us by showing us the netstat output.