java.net.SocketException: No buffer space available (maximum connections reached?): connect

亡梦爱人 提交于 2019-11-28 09:11:20

My guess: you are running out of ports and the issue isn't directly related to your code but to the current state of your server. Too many connections are opened to other machines and this causes the issue.

What to look for:

  • Is your server under heavy usage that might cause multiple network connections to be opened?
  • The HTTP client documentation recommends to instantiate only one HttpClient and to reuse this instance. They are cases where instantiating multiple HTTP clients and not releasing connections correctly causes network connections to stack and never be closed. Try to httpPost.releaseConnection(). You might also be interested in the HTTP client documentation, chapter 1.1.5, "Ensuring release of low level resources"

The server has to few "Ephemeral port" defined se following to links : http://dbaktiar-on-java.blogspot.ro/2010/03/hudson-shows-buffer-space-available.html http://support.microsoft.com/kb/196271

This is solved : followed the steps above an "out of sockets" errors are gone.

Issue is limited to 2003 server.

May happen because Your Server(Database/Http) is exhausted of connections. Use a connection pool or reducing maximum connections can fix this issue.

Derek Bennett

This appears to be a Windows issue, either about ephemeral ports, or about a bug in afd.sys, depending on your version of Windows. Please refer to my answer to a similar question on stackoverflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!