jmeter java.net.SocketException: Socket closed

jmeter 5.1 压测过程中,发现java.net.SocketException: Socket closed
网上查了好多资料, 都说错误的原因是 未设置连接的超时时间
所以HTTP Request Sampler 的 Advanced 页签下设置:
1、Implementation 选为 HttpClient4
2、Timeouts 中的 Connect 一般设置一个10~60秒的值,表示连接的空闲超时时间,避免由于没收到被压测端的响应回来的 Keep-Alive 的 Header 导致的连接断开

设置完后,再跑一遍场景,发现还是会出现Socket closed现象
so,只能再查

通过下面的链接
https://cwiki.apache.org/confluence/display/jmeter/JMeterSocketClosed?spm=a2c4g.11186623.2.16.41ff41eaJzLjlR

Changing configuration:
If you think this server behavior is OK, then configuration can be changed in two places:

Enabling retry
For HttpClient 4, in user.properties set :

httpclient4.retrycount=1
This will make JMeter retry once. For HttpClient 3, in user.properties set:

httpclient3.retrycount=1
This will make JMeter retry once.

Enabling stale check
For HC4 Implementation:

In user.properties:

hc.parameters.file=hc.parameters
In hc.parameters set:

http.connection.stalecheck$Boolean=true
For HC3 Implementation:

In user.properties:

httpclient.parameters.file=httpclient.parameters
In httpclient.parameters set:

http.connection.stalecheck$Boolean=true

我的版本是5.1
参数
hc.parameters.file=hc.parameters
httpclient4.retrycount=1
都在jmeter.properties,不在user.properties文档中

在hc.parameters 文档中设置:
http.connection.stalecheck$Boolean=true

重启jmeter,搞定

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值