Wednesday, April 04, 2012

Resolution for “No buffer space available (maximum connections reached?): JVM_Bind” issue

I hit this issue recently which occurred on only one windows 7 host. The error was caused by this hard to guess reason ( The default number of ephemeral TCP ports is 5000. Sometimes this number may become less if the server has too many active client connections due to which the ephemeral TCP ports are all used up and in this case no more can be allocated to a new client connection request resulting in the below issue (for a Java application):
Caused by: No buffer space available (maximum connections reached?): JVM_Bind
    at Method)
    at org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory.createSocket(
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
    at org.apache.commons.httpclient.HttpClient.executeMethod(

The resolution is to open the registry editor and locate the registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and add a new entry as shown below:

Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
That’s it! Thanks to Daniel Baktiar for his post.

Update 6/14/2012:
Microsoft has a hot fix to resolve this issue for Win2K8 R2 and Win7:


Anonymous said...

Thanks a lot. This fixed the problem.

rwatsh said...

you are welcome.

Micah said...

I got stuck with this issue on my PC but it was not convenient for me to restart the PC to apply the hotfix. Instead, after installing the hotfix (but not restarting) I was able to establish new TCP connections again by entering Services via services.msc at the cmd prompt, then restarting these two services:
DHCP Client
DNS Client

Unknown said...

alas this hotfix has been withdrawn

Anonymous said...

Thanks a lot, it really worked well !

Anonymous said...

I was experiencing this problem while testing a GWT application which was connecting to an SQL Server database. Running on Windows 7 with SQL Server 2008. This soultion fixed it for me.

Rafael Albani said...

Hi, i have a doubt about the type of base to use with this value. Is it Decimal or Hexadecimal?

BTW thanks for the great article!

Rafael Albani said...

Thanks @Watsh Rajneesh

Unknown said...

Thank you so much for your post. That works for me!

Lê Minh Hải said...

Thank so much.
It works

Anonymous said...

Worked for me as well. Very much thank you

Book Review: Graphic Classics: Journey to the Center of the Earth (Barron's Graphic Classics) by Fiona MacDonald, Penko Gelev, Jules Verne

Graphic Classics: Journey to the Center of the Earth by Fiona MacDonald My rating: 4 of 5 stars Got this from our local library. It is a ...