【问题标题】:Receiving error - "org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected" inJMeter接收错误 - “org.apache.http.ConnectionClosedException:块编码消息正文的过早结束:预期关闭块”inJMeter
【发布时间】:2021-10-05 13:09:54
【问题描述】:

我正在使用 JMeter 5.4.1,其中我使用 HTTP 请求进行 Post API 调用。我收到错误消息 - “org.apache.http.ConnectionClosedException:块编码消息正文的过早结束:预期关闭块”。

Keep-Alive 被选中。 超时也设置为 60 秒。

我在线程启动大约 30-45 分钟后收到此错误。我使用的是单线程。

解决这个问题的方法是什么?

org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:263)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:222)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:183)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:148)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1936)
at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:476)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:673)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(Unknown Source)

【问题讨论】:

    标签: jmeter jmeter-5.0 jmeter-4.0 jmeter-3.2


    【解决方案1】:

    该错误表明您的服务器使用chunked Transfer-Encoding并且没有提供last-chunk

    您很可能收到 incomplete 响应,因此 JMeter 报告此错误。

    我的期望是您的服务器超载,因此它无法正确响应 JMeter 的请求,因此从 JMeter 的角度来看,您没有“得到突袭”,这个问题需要在服务器端解决。

    1. 检查您的服务器日志

    2. 确保服务器在CPU、RAM等方面有足够的空间运行,可以使用JMeter PerfMon Plugin来完成

    3. 通过将下一行添加到 log4j2.xml 文件,为 JMeter 的 HTTP 组件启用调试日志记录:

      <Logger name="org.apache.http" level="debug" />
      

      通过这种方式,您将能够在jmeter.log file 中看到完整的请求/响应详细信息,并且应该可以让您了解问题的根源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-25
      • 1970-01-01
      • 2014-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多