如题,jmeter报出java.net.SocketException: Socket closed,我查询了下,服务器是正常的,可以返回数据,基本确定问题出在我这边jmeter。查询原因,看到有人说:该异常在客户端和服务器均可能发生。异常的原因是己方主动关闭了连接后(调用了Socket的close方法)再对网络连接进行读写操作。
请问,这种错误要怎样解决?
参考https://wiki.apache.org/jmeter/JMeterSocketClosed
参考这个改了,重启后还是报此错误。
@liyangzbx: 试试下面
修改/bin/jmeter.bat文件:找到这2行
set HEAP=-Xms256m -Xmx256m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
改为:
set HEAP=-Xms256m -Xmx1024m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=512m
@ycyzharry: 之前看服务器有报gc overhead limit exceeded,查了下内存溢出的问题,已经把这两行改了,还是继续报错。
@liyangzbx: 看下这个http://blog.csdn.net/miss_hua/article/details/50549606
另外还要考虑是不是服务端问题
@ycyzharry: 确认改这里可行,一直增加,直到60ms,不再报错了。但是有个疑问,改jmeter的配置是否会对压测结果有影响?
@liyangzbx: 有些间隔时间对结果比如响应时间等会有影响
@ycyzharry: 是的,就是考虑的这个问题。如果影响真实响应时间就不行了
@liyangzbx: 测出来的结果和用其他工具测出来的结果对比下就知道了
参考:http://littcai.iteye.com/blog/225916
请问园主最后是怎么解决的?
楼主 你最后怎么解决的呢,我也碰到这个问题了,怎么都找不到原因 也不是内存溢出 报错如下 能帮忙看下吗
java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:158) at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:82) at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:271) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:259) at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:209) at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.receiveResponseHeader(MeasuringConnectionManager.java:212) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:686) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:488) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:884) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:654) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:413) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1166) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1155) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:475) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:418) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249) at java.lang.Thread.run(Unknown Source)
修改JMeter.properties文件配置
httpclient4.idletimeout=<time in ms> 设置成自己觉得合理的时间,一般可设置成10-60s(表示连接空闲10s后才会断开),注意这边单位是ms。修改完成后再次压测,错误不再有了
注意:如果是远程分布式执行每台执行机上均需修改参考资料
我改了配置文件还是报这个错,请问大佬还有别的方法吗?