寻找java.net.SocketException:没有可用的缓冲区空间 [英] Hunt down java.net.SocketException: No buffer space available

查看:421
本文介绍了寻找java.net.SocketException:没有可用的缓冲区空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常丑陋的问题:
java.net.SocketException:没有可用的缓冲区空间(达到最大连接数?)
它是客户端 - 服务器应用程序。客户端是Windows XP SP2 32b,带有两个网卡核心二重奏。 Java 1.6。
u7。
应用程序有几个服务器套接字打开用于本地通信和几个客户端套接字用于rmi到jboss服务器。

Hi I have very ugly problem with: java.net.SocketException: No buffer space available (maximum connections reached?) It is client-server app. Client is Windows XP SP2 32b, with two net cards core duo. Java 1.6. u7. Application have couple server socket open for local communication and couple of client socket for rmi to jboss server.

几小时/天后!我无法打开任何新的客户端套接字与服务器进行通信。服务器套接字仍然有效。

After couple of hours/days! i am unable to open any new client socket to do communication to server. Server sockets still works.

Windows netstat显示130到150的连接。在~3500连接后手动尝试我耗尽缓冲区时!

Windows netstat shows something from 130 to 150 connection. When manually trying I exhausted buffer after ~3500 connections!

我试过:

  • 检查我们使用的每个插槽,我们也关闭它。

  • 在后台运行netstat以监控已打开的连接

  • 运行病毒扫描以发现任何恶意软件

  • 将java更新为1.6 u16

  • 禁用第二个网络接口




  • 重启java后,我可以打开新连接。

    I tried:

  • check every socket we use that we also close it.
  • run netstat at background to monitor opened connections
  • run virus scan to found any malware
  • update java to 1.6 u16
  • disable second network interface

  • Once java is restarted I am able to open new connection.

    全部异常:

    
    cause:javax.naming.CommunicationException: Failed to connect to server IP:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server IP:1099 [Roo
    t exception is java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind]]
    2009-08-03 09:13:18,968 DEBUG [Thread-9] - stack trace:
    2009-08-03 09:13:18,968 DEBUG [Thread-9] - org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
    2009-08-03 09:13:18,968 DEBUG [Thread-9] - org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
    2009-08-03 09:13:18,968 DEBUG [Thread-9] - org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    2009-08-03 09:13:18,968 DEBUG [Thread-9] - javax.naming.InitialContext.lookup(Unknown Source)
    

    - 已编辑

    我们终于解决了snmp服务器故障的问题。我在评论中写下了我的笔记。感谢您的帮助。

    推荐答案

    我们尝试(并成功)解决问题的方法。
    JAVA
    - 再次检查我们使用的每个套接字,如果需要,在一些特殊类中注册它们
    - 为每个打开套接字的类提供SocketFactory和ServerSocketFactory(例如jboss Connectors)

    - 检查打开的文件,最后将它们关闭

    - URL也打开连接,但如果你之后要求流,则连接与流一起关闭(感谢Stephen)。 br>


    OS

    - 使用不同的java(1.5,1.6,1.7)

    - 安装新驱动程序

    - 使用netstat并监控后台流量(使用脚本,是的win xp可以很好地完成脚本)。如果需要,使用高级数据包嗅探器(线鲨?)。

    - win xp对并发连接有限制,检查它们(谷歌)


    - 一次又一次地检查病毒和mallware (甚至在私人网络上!)

    What we tried (and successfully) kill the problem. JAVA - check again every socket we used, register them in some special class if needed
    - provide SocketFactory and ServerSocketFactory for every class which open socket itself (for example jboss Connectors)
    - check opened files, close them in finally
    - URL opens connection too, but if you ask for stream after that, connection is closed together with stream (thanks Stephen).

    OS
    - use different java (1.5, 1.6, 1.7)
    - install new drivers
    - use netstat and monitor traffic on background (using scripts, yes win xp can do the scripts pretty nicely). Use advanced packet sniffers (wire shark?) if needed.
    - win xp have limit for concurrent connections, check them (google) too
    - check again and again for virus and mallware (even on private network!)

    这篇关于寻找java.net.SocketException:没有可用的缓冲区空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆