Java.net. socketexception: no buffer space available

Source: Internet
Author: User
It's hard to believe that this problem was caused by this (http://support.microsoft.com/kb/196271 ). the Hudson CI application is currently running on Windows Server 2003 box. this version of Windows server has something called "Maximum ephemeral port number ".

Quoting from this Wikipedia entry:

"Ephemeral port is a transport protocol port for Internet Protocol (IP) Communications allocated automatically from a predefined range by the TCP/IP stack software. it is typically used by the TCP, UDP or sctp as port for the client end of a client-server communication when the application doesn't bind the socket to a specific port number, or by a server application to free up service's well known listening port and establish a service connection to the client host. the allocations are temporary and only valid for the duration of the connection. after completion of the communication session the ports become available for reuse, although most implementations simply increment the last used port number until the ephemeral port range is exhausted."

According to the Microsoft support website:

Windows Vista and Windows Server 2008 use the IANA suggested ephemeral ports range while the Windows Server 2003 is still using port range of 1250 to 5000.

Ephemeral ports are short-lived port, chosen ad-hoc to serve. In most implementations, they usually only add the port numbers by one until get exhausted on port numbers.

May be this is just my silly thought of me, but it seems like they implemented like this pseudo-code:

[Sourcecode lang = "Python"]
Next_port_num = 1250

Def get_next_ephemeral_port_num ():
Result = next_port_num
Next_port_num = next_port_num + 1
If next_port_num> 5000:
Raise valueerror ('no buffer space available ')
Return result
[/Sourcecode]

I wasn't really sure that it is the cause of the problem, but I guess no kangaroo being harmed in the making of the game, so I tried it anyway.

The remedy was simply, run the Registry Editor in the administrator privilege, open the key HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters and create new DWORD entry, "maxuserport ", fill with 65534.

The result, after 2 days monitoring, Hudson is still running well.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.