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

后端 未结 4 599
孤城傲影
孤城傲影 2020-12-09 17:53

Hi I am using Apache HTTP Client 4.0 to upload some files on a server based on HTTPS protocol. The uploaded application is running 24x7. Today suddenly it started to throw t

相关标签:
4条回答
  • 2020-12-09 18:01

    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

    0 讨论(0)
  • 2020-12-09 18:05

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

    0 讨论(0)
  • 2020-12-09 18:11

    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.

    0 讨论(0)
  • 2020-12-09 18:18

    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"
    0 讨论(0)
提交回复
热议问题