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
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
May happen because Your Server(Database/Http) is exhausted of connections. Use a connection pool or reducing maximum connections can fix this issue.
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.
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:
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"