通过TCP采样器向服务器(中间件)发送消息时,Jmeter抛出Read Exception

gdrx4gfi  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(226)

我正在使用JMeter来加载测试中间件服务器,使用TCP Sampler(TCPClientImpl类)来发送下面的消息:message formatTcp Sampler setting显示器
在发送请求时,我得到了500响应代码

错误

Response code:500
Response message:org.apache.jmeter.protocol.tcp.sampler.ReadException: Error reading from server, bytes read: 0

日志

2022-03-03 12:46:37,265 ERROR o.a.j.p.t.s.TCPSampler: 
org.apache.jmeter.protocol.tcp.sampler.ReadException: Error reading from server, bytes read: 0
    at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:122) ~[ApacheJMeter_tcp.jar:5.4.3]
    at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:398) [ApacheJMeter_tcp.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.3]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.net.SocketTimeoutException: Read timed out
    at sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283) ~[?:?]
    at sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309) ~[?:?]
    at sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350) ~[?:?]
    at sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803) ~[?:?]
    at java.net.Socket$SocketInputStream.read(Socket.java:966) ~[?:?]
    at java.io.InputStream.read(InputStream.java:218) ~[?:?]
    at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:105) ~[ApacheJMeter_tcp.jar:5.4.3]
w7t8yxp5

w7t8yxp51#

这意味着采样器未能在您设置为2秒的超时范围内接收响应。
尝试增加TCP采样器中的超时(或者更好地使用TCP采样器配置,它的作用类似于HTTP请求采样器的HTTP Request Defaults,主机、端口、超时等将应用于您拥有的所有TCP采样器)
如果错误仍然存在,请使用telnet client或等效软件仔细检查TCP服务所在的主机/端口组合的网络连接

相关问题