Jmeter出现java.net.SocketException: Socket closed解决方法

java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:171)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
	at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
	at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
	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.execchain.MainClientExec.execute(MainClientExec.java:272)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:843)
	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:574)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1231)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1220)
	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622)
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546)
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486)
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253)
	at java.lang.Thread.run(Thread.java:745)

问题原因:在JMeter下,发送http 请求时,一般都是默认选择了use keepAlive(这个是什么?看后面资料),这个是连接协议,JMeter坑就在这里,默认勾选了这个(如果不勾选的话,也不会保存),但其配置JMeter.properties中的时间设置默认却是注销的,也是是说,不会等待,一旦连接空闲,则立马断开了,导致我们压测中出现了事务失败的情形。

Jmeter出现java.net.SocketException: Socket closed解决方法_第1张图片

解决:修改httpclient4.idletimeout=

Jmeter出现java.net.SocketException: Socket closed解决方法_第2张图片

你可能感兴趣的:(Jmeter出现java.net.SocketException: Socket closed解决方法)