The possibility analysis of java.net.SocketException anomaly
Recently in an MQ project, when deployed, after running every two or three days down the machine once, the software died. Through System log Analysis:
InforSuiteV6.0.0 Build2009042101 started
2010-3-29 15:58:36 clientcommunicatoradmin Restart
Warning: Failed to restart:java.io.IOException:Failed to get a RMI stub:javax.na
Ming.communicationexception [Root exception is Java.rmi.ConnectIOException:Exce
Ption Creating connection to:127.0.0.1; Nested exception is:
Java.net.SocketException:No buffer space available (maximum connections
Reached?): Jvm_bind]
2010-3-29 15:58:36 Rmiconnector Rmiclientcommunicatoradmin-dostop
Warning: Failed to call the method close (): Java.rmi.ConnectIOException:Exception C
reating connection to:10.0.0.2; Nested exception is:
Java.net.SocketException:No buffer space available (maximum connections
Reached?): Jvm_bind
2010-3-29 15:58:36 clientcommunicatoradmin Checker-run
Warning: Failed to check connection:java.net.SocketException:No buffer spaces Avai
Lable (maximum connections reached?): Jvm_bind
2010-3-29 15:58:36 clientcommunicatoradmin Checker-run
Warning: Stopping
2010-3-29 15:58:52 clientcommunicatoradmin Restart
Warning: Failed to restart:java.io.IOException:Failed to get a RMI stub:javax.na
Ming.communicationexception [Root exception is Java.rmi.ConnectIOException:Exce
Ption Creating connection to:127.0.0.1; Nested exception is:
Java.net.SocketException:No buffer space available (maximum connections
Reached?): Jvm_bind]
It was found that some socket exceptions were thrown, which were caused by the use of the file handle. In other words, the open socket inside the program, did not shut down in time. In order to further seek technical support, verify that the analysis is reasonable and find Sun's website information:
Chances are you are forgetting to close a socket, a database connection, or some other connection this uses sockets Ally. Example program below.
The alternative is this your program (or the sum of all programs running on your computer) really needs a lot of connectio Ns. In this case you'll need to the increase the amount of socket buffer spaces that your operating system allocate S. I ' d start by Googling for instructions. Or Maybe you could redesign your program so, that it doesn ' t is very much.
Sun's technical support confirms the justification for the previous analysis. Java.net.SocketException exception and socket is not closed, the operating system has the maximum number of file handles it allows to hold, while in the process of network connection, each socket request occupies a file handle resource, if not released in time, The file handle resource may be exhausted.
Therefore, in time to close those no longer use the socket, can reasonably solve the thrown java.net.SocketException exception.