`

有关java.net.SocketException: No buffer space available的问题

 
阅读更多
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.
分享到:
评论

相关推荐

    JAVA.NET.SOCKETEXCEPTION TOO MANY OPEN FILES解决方法

    JAVA.NET.SOCKETEXCEPTION TOO MANY OPEN FILES解决方法 JAVA.NET.SOCKETEXCEPTION TOO MANY OPEN FILES错误是一种常见的网络编程错误,发生在Java应用程序中, especialmente 在 Linux 操作系统中。该错误的出现是...

    java.net.SocketException: No route to host 异常原因

    NULL 博文链接:https://zhoudan241.iteye.com/blog/1432014

    在Win7系统下抛出java.net.SocketException的解决办法

    解决上述问题的关键在于解决最初的`java.net.SocketException`异常,因为一旦解决了这一问题,后续的异常往往也会随之消失。具体步骤如下: 1. **配置JVM参数**:在启动JVM时添加参数`-Djava.net.preferIPv4Stack=...

    java.net.SocketException Connection reset 解决方法

    "java.net.SocketException Connection reset 解决方法" 在 Java 编程中,SocketException 是一种常见的异常,特别是在网络编程中。Conexion reset by peer 是一种特殊的 SocketException,它发生在客户端和服务器...

    java.net.SocketException: Connection reset 解决方法

    Java中的`java.net.SocketException: Connection reset`是一个常见的网络编程错误,通常表示在TCP/IP通信过程中,连接突然中断。这个异常可能在客户端或服务器端发生,通常与数据传输的异常中断有关。 首先,我们来...

    http接口调用报错.rar

    接口调用报错:java.net.SocketException: java.lang.ClassNotFoundException: Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

    Linux下打开的文件过多错误

    Linux下运行tomcat或者was出现java.net.SocketException: 打开的文件过多错误 tomcat报“too many open files”的错误,解决办法如下:

    Java Socket常见异常处理

    4. **java.net.SocketException: (Connection reset 或 Connect reset by peer: Socket write error)** 这两种异常都表示连接已断开。可能的原因是一端关闭了Socket,而另一端仍在尝试读写。处理这类异常需要检测到...

    如何解决线程太多导致java socket连接池出现的问题

    3. 错误信息:当Socket连接池出现问题时,可能会出现错误信息,如"java.net.SocketException: No buffer space available (maximum connections reached?): listen failed"。 解决方法 要解决线程太多导致Socket...

    connection reset解决方案(亲测可用).md

    connection reset解决方案(亲测可用).md

    fastdfs使用java

    配置client.conf文件,设置tracker服务器的地址和其他相关参数。接着创建FastdfsClient和FastdfsUtil类,前者用于与FastDFS服务器通信,后者封装常用操作,如上传、下载文件的方法。在实际应用中,可以调用...

    java.net.SocketException(解决方案).md

    常见的问题

    Ice-3.7.4.msi for windows版

    Caused by: java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574) at ...

    Socket长连接异常处理

    java.net.SocketException: Connection reset by peer: Socket write error 该异常可能发生在客户端和服务器端,原因是因为一端的 Socket 被关闭,而另一端继续发送数据。解决方法是确保在关闭连接前完成所有的数据...

    Google I/O 2013推荐Android 网络通信框架Volley

    ```java RequestQueue queue = Volley.newRequestQueue(this); ``` 2. 创建Request对象:根据实际需求创建对应的Request子类,如StringRequest、JsonArrayRequest等。 ```java String url = ...

    System.SR.dll 无法显示错误信息

    System.Net.WebException: 无法显示错误消息,原因是无法找到包含此错误消息的可选资源程序集 ---> System.Net.Sockets.SocketException: 无法显示错误消息,原因是无法找到包含此错误消息的可选资源程序集 ...

    Hive2Hive-master.rar

    下面我们将详细探讨Socket与Hive数据同步的相关知识点。 1. **Socket基础**: Socket是网络通信中的一个端点,可以理解为两台计算机之间通信的通道。它提供了一种双向通信机制,允许数据双向流动。在Java中,...

    C# 服务器发送邮件失败实例分析

    错误展示: 我在本地是可以发送的但部署到服务器上后就不能发送了。...邮件发送相关端口 首先说下邮件发送的端口:25/465/587 25端口 25端口是为SMTP协议服务开放的,是这三个端口中最老的一个。25端口也称为消息中继端

    java网络编程示例

    import java.net.SocketException; public class UDPServer { public static void main(String[] args) { try { byte [] buffer = new byte[1024]; DatagramSocket socket = new DatagramSocket(4444); ...

Global site tag (gtag.js) - Google Analytics