我使用 JMeter 测试来检查我们的应用程序是否正在运行。测试是从 Jenkins 通过 ANT<jmeter>
标签运行的。问题是,JMeter 时不时地永远挂起(并且 Jenkins 执行程序被阻止因为仍在运行)。在两个月内(每 10 分钟运行一次测试),只发生了两次这样的挂起,但今天,两个并行测试同时卡住了(在 5 分钟内,不同的测试)。我确实怀疑网络连接(它经常超载且不可靠),但我希望测试即使在这样的环境中也是可靠的。
卡住进程的线程转储是:
[jmeter] "User test 1-1" prio=10 tid=0x00007fd56c43f000 nid=0x2797 runnable [0x00007fd5704e2000]
[jmeter] java.lang.Thread.State: RUNNABLE
[jmeter] at java.net.SocketInputStream.socketRead0(Native Method)
[jmeter] at java.net.SocketInputStream.read(SocketInputStream.java:146)
[jmeter] at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204)
[jmeter] at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:177)
[jmeter] at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:201)
[jmeter] at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1649)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:235)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:300)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1410)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1481)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:251)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:358)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
[jmeter] at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
[jmeter] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
[jmeter] at java.lang.Thread.run(Thread.java:679)
从第二个测试开始(这个测试 www.google.com 的可达性):
[jmeter] "www.google.com 1-1" prio=10 tid=0x0000000000d32000 nid=0x27e8 runnable [0x00007fb9fea54000]
[jmeter] java.lang.Thread.State: RUNNABLE
[jmeter] at java.net.SocketInputStream.socketRead0(Native Method)
[jmeter] at java.net.SocketInputStream.read(SocketInputStream.java:146)
[jmeter] at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204)
[jmeter] at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:177)
[jmeter] at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:201)
[jmeter] at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1649)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:235)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:300)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
[jmeter] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
[jmeter] at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
[jmeter] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
[jmeter] at java.lang.Thread.run(Thread.java:679)
我使用HTTP Request
具有默认值的采样器:
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="www.google.cz" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">www.google.cz</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<boolProp name="HTTPSampler.monitor">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSamplerProxy>
没有设置超时,但我尝试默认超时为 240 秒 - 当我尝试从无GET
响应的站点访问时,一切正常,240 秒后 JMeter 任务失败(如预期的那样)。
JMeter 版本是 2.9,在 linux 机器上运行。
当我向系统管理员询问网络时,他说可能是超载了。我无法重现该错误,因为它发生得如此稀疏(我也没有 TCP 转储)。
我想到了两种可能的解决方法:
- 向 JMeter 添加超时以终止有问题的线程 -我不确定如何,有什么提示吗?
- 为 Jenkins 添加超时 - 使用Build-timeout 插件
但我想解决问题,而不是解决问题。 你有什么建议吗?
线程仍然卡住,可以从中提取一些有用的信息吗?我只是用来kill -3 $PID
获取线程转储。