jmeter给出错误没有可用的缓冲区空间(达到最大连接数?):connect

时间:2012-04-26 16:13:29

标签: java unit-testing jmeter load-testing socketexception

Number of threads = 20 
Ramp-up period = 10 
Loop count = 200

在一段时间后出错:

java.net.SocketException: No buffer space available (maximum connections reached?): connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:478)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:234)
    at sun.net.www.http.HttpClient.New(HttpClient.java:307)
    at sun.net.www.http.HttpClient.New(HttpClient.java:324)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(HTTPJavaImpl.java:483)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1018)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1004)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:411)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:297)
    at java.lang.Thread.run(Thread.java:662)

2 个答案:

答案 0 :(得分:1)

似乎你可能遇到的问题不是你的jmeter实例,而是os / env。

  1. 根据这些链接查看建议:
    Hunt down java.net.SocketException: No buffer space available
    http://www.codeweblog.com/no-buffer-space-available/

  2. 如果您在WinXP等操作系统上运行您的jmeter,请查看these instructions

答案 1 :(得分:0)

可能是你没有关闭连接。尝试更改采样器上的“保持活动”选项,但请记住检查实际发送的内容以及来自真实浏览器的实际请求(您不希望掩盖潜在问题)。也可能是您的服务器未配置为关闭连接,这也可能是您应用程序的真正问题。