java.net.SocketException异常的可能性分析
2010-04-09 11:32
288 查看
java.net.SocketException异常的可能性分析
近来在做一个MQ的项目,当部署完毕,运行后每隔两三天就会down机一次,软件死了。通过系统日志分析:
InforSuiteV6.0.0 Build2009042101 started
2010-3-29 15:58:36 ClientCommunicatorAdmin restart
警告: 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
警告: 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
警告: Failed to check connection: java.net.SocketException: No buffer space avai
lable (maximum connections reached?): JVM_Bind
2010-3-29 15:58:36 ClientCommunicatorAdmin Checker-run
警告: stopping
2010-3-29 15:58:52 ClientCommunicatorAdmin restart
警告: 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]
发现抛出了一些Socket异常,这些异常均是由文件句柄使用完毕而引起的。也就是说程序里面打开的socket,没有及时关闭掉。为了进一步寻求技术支持,确认分析是否合理,寻找sun的网站资料:
Chances are you are forgetting to close a socket, a database connection, or some other connection that uses sockets internally. See example program below.
The alternative is that your program (or the sum of all programs running on your computer) really needs a lot of connections. In this case you'll need to find out how to increase the amount of socket buffer space that your operating system allocates. I'd start by googling for instructions. Or maybe you could redesign your program so that it doesn't use so much resources.
Sun的技术支持确认了之前分析的有理。java.net.SocketException异常与socket没有关闭有关,操作系统有它允许持有的最大文件句柄数,而在网络连接的过程中,每个socket请求都要占用一个文件句柄资源,如果没有及时释放,则可能会耗尽文件句柄资源.
所以,及时关闭那些不再使用的socket,能够合理的解决抛出的java.net.SocketException异常。
近来在做一个MQ的项目,当部署完毕,运行后每隔两三天就会down机一次,软件死了。通过系统日志分析:
InforSuiteV6.0.0 Build2009042101 started
2010-3-29 15:58:36 ClientCommunicatorAdmin restart
警告: 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
警告: 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
警告: Failed to check connection: java.net.SocketException: No buffer space avai
lable (maximum connections reached?): JVM_Bind
2010-3-29 15:58:36 ClientCommunicatorAdmin Checker-run
警告: stopping
2010-3-29 15:58:52 ClientCommunicatorAdmin restart
警告: 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]
发现抛出了一些Socket异常,这些异常均是由文件句柄使用完毕而引起的。也就是说程序里面打开的socket,没有及时关闭掉。为了进一步寻求技术支持,确认分析是否合理,寻找sun的网站资料:
Chances are you are forgetting to close a socket, a database connection, or some other connection that uses sockets internally. See example program below.
The alternative is that your program (or the sum of all programs running on your computer) really needs a lot of connections. In this case you'll need to find out how to increase the amount of socket buffer space that your operating system allocates. I'd start by googling for instructions. Or maybe you could redesign your program so that it doesn't use so much resources.
Sun的技术支持确认了之前分析的有理。java.net.SocketException异常与socket没有关闭有关,操作系统有它允许持有的最大文件句柄数,而在网络连接的过程中,每个socket请求都要占用一个文件句柄资源,如果没有及时释放,则可能会耗尽文件句柄资源.
所以,及时关闭那些不再使用的socket,能够合理的解决抛出的java.net.SocketException异常。
相关文章推荐
- java.net.SocketException: Software caused connection abort: recv failed 异常分析
- java.net.SocketException: Write failed: Broken pipe异常分析 .
- java.net.SocketException:Software caused connection abort: recv failed 异常分析 +socket客户端&服务端代码
- java.net.SocketException:Software caused connection abort: recv failed 异常分析
- ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error"异常原因分析
- java.net.SocketException: Write failed: Broken pipe异常分析 .
- java.net.SocketException:Software caused connection abort: recv failed 异常分析
- java.net.SocketException: Software caused connection abort: recv failed 异常分析
- java.net.SocketException五大异常解决方案(转)
- 使用javamail出现java.net.SocketException: Network is unreachable: connect异常 解决方法
- Android异常总结---1.Android java.net.SocketException: Address family not supported by protocol
- Java使用HttpURLConnection请求异常:java.net.SocketException: Software caused connection abort: recv failed
- 异常Java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind处理方法
- Linux上Tomcat访问异常java.net.SocketException: Too many open files
- java异常处理:java.net.SocketException
- Android:使用Socket网络通信时异常:java.net.SocketException: socket closed
- 网络编程之java.net.SocketException: Connection reset异常问题(二)
- java.net.sockettimeoutexception read timed out 异常
- weblogic 出现 java.net.SocketException 异常可能是一个页面的小问题导致的。
- Android真机调试异常java.net.SocketTimeoutException