Blazemeter / jmeter-http2-plugin

HTTP2 plugin for Apache JMeter
Apache License 2.0
45 stars 27 forks source link

Buffering capacity 2097152 exceeded #22

Closed asat2094 closed 1 year ago

asat2094 commented 2 years ago

Steps to reproduce:

  1. Add HTTP2 sampler.

  2. Enable embedded resource download

This issue is occurring in the latest release of JMeter. On my web page, I had ~50 embedded resources hence I had this error on the last 3 requests out of all the requests.

Response code:Non HTTP response code: java.util.concurrent.ExecutionException
Response message:Non HTTP response message: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded

full stacktrace is as follows:

java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
    at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:113)
    at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:96)
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:770)
    at com.blazemeter.jmeter.http2.core.HTTP2JettyClient.sample(HTTP2JettyClient.java:150)
    at com.blazemeter.jmeter.http2.sampler.HTTP2Sampler.sample(HTTP2Sampler.java:57)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$ASyncSample.call(HTTPSamplerBase.java:2155)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase$ASyncSample.call(HTTPSamplerBase.java:2123)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
    at org.eclipse.jetty.client.util.BufferingResponseListener.onContent(BufferingResponseListener.java:119)
    at org.eclipse.jetty.client.api.Response$ContentListener.onContent(Response.java:154)
    at org.eclipse.jetty.client.api.Response$AsyncContentListener.onContent(Response.java:185)
    at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:150)
    at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:134)
    at org.eclipse.jetty.client.HttpReceiver$ContentListeners.notifyContent(HttpReceiver.java:697)
    at org.eclipse.jetty.client.HttpReceiver$Decoder.decodeChunk(HttpReceiver.java:840)
    at org.eclipse.jetty.client.HttpReceiver$Decoder.decode(HttpReceiver.java:792)
    at org.eclipse.jetty.client.HttpReceiver$Decoder.decode(HttpReceiver.java:772)
    at org.eclipse.jetty.client.HttpReceiver.decodeResponseContent(HttpReceiver.java:383)
    at org.eclipse.jetty.client.HttpReceiver.responseContent(HttpReceiver.java:351)
    at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2.access$200(HttpReceiverOverHTTP2.java:52)
    at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2$ContentNotifier.process(HttpReceiverOverHTTP2.java:321)
    at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2$ContentNotifier.offer(HttpReceiverOverHTTP2.java:259)
    at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2.notifyContent(HttpReceiverOverHTTP2.java:235)
    at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2.onData(HttpReceiverOverHTTP2.java:204)
    at org.eclipse.jetty.http2.client.http.HttpChannelOverHTTP2$Listener.onData(HttpChannelOverHTTP2.java:187)
    at org.eclipse.jetty.http2.api.Stream$Listener.onDataDemanded(Stream.java:256)
    at org.eclipse.jetty.http2.HTTP2Stream.notifyDataDemanded(HTTP2Stream.java:798)
    at org.eclipse.jetty.http2.HTTP2Stream.processData(HTTP2Stream.java:522)
    at org.eclipse.jetty.http2.HTTP2Stream.onData(HTTP2Stream.java:480)
    at org.eclipse.jetty.http2.HTTP2Stream.process(HTTP2Stream.java:368)
    at org.eclipse.jetty.http2.HTTP2Session.onData(HTTP2Session.java:261)
    at org.eclipse.jetty.http2.HTTP2Connection$ParserListener.onData(HTTP2Connection.java:407)
    at org.eclipse.jetty.http2.parser.BodyParser.notifyData(BodyParser.java:103)
    at org.eclipse.jetty.http2.parser.DataBodyParser.onData(DataBodyParser.java:145)
    at org.eclipse.jetty.http2.parser.DataBodyParser.onData(DataBodyParser.java:140)
    at org.eclipse.jetty.http2.parser.DataBodyParser.parse(DataBodyParser.java:113)
    at org.eclipse.jetty.http2.parser.Parser.parseBody(Parser.java:193)
    at org.eclipse.jetty.http2.parser.Parser.parse(Parser.java:122)
    at org.eclipse.jetty.http2.HTTP2Connection$HTTP2Producer.produce(HTTP2Connection.java:278)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produceTask(AdaptiveExecutionStrategy.java:446)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:239)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:190)
    at org.eclipse.jetty.http2.HTTP2Connection.produce(HTTP2Connection.java:208)
    at org.eclipse.jetty.http2.HTTP2Connection.onFillable(HTTP2Connection.java:155)
    at org.eclipse.jetty.http2.HTTP2Connection$FillableCallback.succeeded(HTTP2Connection.java:378)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:538)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:387)
    at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:161)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.SocketChannelEndPoint$1.run(SocketChannelEndPoint.java:101)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:378)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038)
    ... 1 more

Please refer the image below.

image

RicardoPoleo commented 2 years ago

Hello @asat2094,

Thanks for taking the time to report this issue, we really appreciate it.

We tested and added that issue to our backlog, and we will be working on that in the near future.

When the release with the fix is made, I'll come back to you to let you know!

Happy Hacking!

keklabs commented 2 years ago

Hello, I have the same issue with simple HTTP2 get request which only donwloads the attachment with 30MB size.

Request:

GET https://example.com/service/binary/getData?code=big_zip00614

Response Body:

java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
    at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:113)
    at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:96)
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:770)
    at com.blazemeter.jmeter.http2.core.HTTP2JettyClient.sample(HTTP2JettyClient.java:150)
    at com.blazemeter.jmeter.http2.sampler.HTTP2Sampler.sample(HTTP2Sampler.java:57)
    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.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
    at org.eclipse.jetty.client.util.BufferingResponseListener.onContent(BufferingResponseListener.java:119)
    at org.eclipse.jetty.client.api.Response$ContentListener.onContent(Response.java:154)
    at org.eclipse.jetty.client.api.Response$AsyncContentListener.onContent(Response.java:185)
    at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:150)
    at org.eclipse.jetty.client.ResponseNotifier.notifyContent(ResponseNotifier.java:134)
    at org.eclipse.jetty.client.HttpReceiver$ContentListeners.notifyContent(HttpReceiver.java:697)
    at org.eclipse.jetty.client.HttpReceiver.plainResponseContent(HttpReceiver.java:366)
    at org.eclipse.jetty.client.HttpReceiver.responseContent(HttpReceiver.java:349)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.content(HttpReceiverOverHTTP.java:327)
    at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1823)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1534)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:213)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:153)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:87)
    at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:90)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:193)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:538)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:387)
    at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:161)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.SocketChannelEndPoint$1.run(SocketChannelEndPoint.java:101)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:378)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038)
    ... 1 more

Is there any progress in fixing this issue ?

vivekbachu commented 1 year ago
image

@RicardoPoleo, Is there any update on this issue, even I am facing this issue. Thank you !

kishaningithub commented 1 year ago

From my analysis, i see the problem occurs because of this

  1. The request is sent out by the sample() method in HTTP2JettyClient using the send() method in request object (screenshot below)

    Screenshot 2022-07-21 at 3 46 30 PM
  2. The send() method in jetty-client creates a FutureResponseListener using the default constructor (screenshot below)

    Screenshot 2022-07-21 at 3 48 03 PM
  3. The default constructor creates the response listener with a max buffer size of 2 MB hence causing the responses to fail if they are greater than 2 MB (screenshot below)

    Screenshot 2022-07-21 at 3 49 00 PM

Possible solutions

  1. HTTP2 Jetty client makes this configurable
  2. Use sendAsync methods which allows customizing the listener
  3. Extend HTTPRequest class and expose a config for max buffer size
RicardoPoleo commented 1 year ago

Hello @asat2094 @kishaningithub @vivekbachu & @keklabs

Thanks for taking the time to come back at this issue.

Our team developed the fix that allows setting the max size of the buffer files on the JMeter's properties. We are waiting for other features to end before releasing it to the community.

I'll keep you all posted,

kishaningithub commented 1 year ago

Hi @RicardoPoleo Thanks for the response! Curious to know whether we are looking at days or weeks or months for the next release just so that people affected by this issue can plan accordingly.

RicardoPoleo commented 1 year ago

Hello @kishaningithub,

We plan to make the release throughout these two weeks and, as mentioned before, I'll be keeping you all posted when we do it šŸ˜„.

RicardoPoleo commented 1 year ago

Hello everyone,

I apologize for the delayed release, we wanted to be sure this fix solves the issues you are having.

I'll leave it as a pre-release, waiting for a confirmation from you all.

Check the files in the releases and let me know what do you think (@kishaningithub @keklabs @asat2094 @vivekbachu).

As always, thanks and happy hacking šŸŽ‰

vivekbachu commented 1 year ago

Hi @RicardoPoleo, Thank you for response !

I've tested using the latest jars provided in https://github.com/Blazemeter/jmeter-http2-plugin/releases/tag/v2.1 and updating jmeter.properties as suggested.

The earlier error has now resolved, but the request's response which are going beyond 2MB, when we hit such request's in some loop count, in the very first response we are getting below error, but the same request when hit for 2nd/3rd and nth time in the loop of the same thread group, we can see it is success. Can you please help us resolving this? Below are the screenshots/full stack traces -

image
java.lang.NullPointerException: Cannot throw exception because the return value of "java.lang.Exception.getCause()" is null
    at com.blazemeter.jmeter.http2.core.HTTP2JettyClient.send(HTTP2JettyClient.java:181)
    at com.blazemeter.jmeter.http2.core.HTTP2JettyClient.sample(HTTP2JettyClient.java:153)
    at com.blazemeter.jmeter.http2.sampler.HTTP2Sampler.sample(HTTP2Sampler.java:57)
    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.base/java.lang.Thread.run(Thread.java:832)
RicardoPoleo commented 1 year ago

Hi @vivekbachu,

Reviewing the trace and the explanation provided, it appears that "the 1st time you hit that endpoint, it is taking too long to answerā€ thus, triggering aTimeoutException, which, we are failing to report in the log due to the NullPointerException (NPE).

Regarding the subsequent requests (2nd, 3rd, and so on) to that same end point, they are not taking that long to answer, so they succeed.

As a workaround, you can increase the JMeter's timeout property, to avoid throwing an error in that scenario. It is set, by default, in 2 secs (2000 ms), but you can use whatever time you consider proper.

Something like this will wait 30 secs (30000 ms) before throwing a timeout exception.

HTTPSampler.response_timeout = 30000

Before attempting to fix this NPE, could you try playing with the workaround and let me know how does it work for you?

vivekbachu commented 1 year ago

Hi @RicardoPoleo ,

After updating jmeter properties file with HTTPSampler.response_timeout = 30000 . I could able to see even the first request gets success.

Thank you!

RicardoPoleo commented 1 year ago

I'm happy to see that your issue was fixed @vivekbachu.

I'll be closing this issue now, since the fix was added to the latest release. Don't hesitate to open another if any issue rises.

I hope all of you have a happy week!