#238 HTTPClient Retry Attempts


I’m using grinder-3.4 for load testing. I’m using Test class wrap method to call HTTPRequest class GET method.

For particular tests, after connecting to the server and sending the request, the server fails to respond and closes the connection. It appears the HTTPRequest object reconnects to the server and resends the original request. The HTTPRequest object will re-attempt to obtain a response 2 times (3 attempts in total) before an Exception is raised.

In my test script I can reduce the number of threads/runs to 1 so I expect to see one transaction. The grinder script connects to the server and sends a single request. In this particular example, the server has an issue with the request it received and sends a NAK back to grinder and closes the socket abruptly. Grinder immediately reconnects to the server, and sends the same request, issue repeats. Three attempts in total.

09/05/13 10:02:44 (thread 0 run 15 test 1): Aborted run due to Java exception calling TestRunner

Java exception calling TestRunner

  response =  test.GET(URL).getText()

Caused by: HTTPClient.RetryException: Premature EOF encountered

  at HTTPClient.StreamDemultiplexor.retry_requests(StreamDemultiplexor.java:530)

  at HTTPClient.StreamDemultiplexor.close(StreamDemultiplexor.java:498)

  at HTTPClient.StreamDemultiplexor.read(StreamDemultiplexor.java:369)

  at HTTPClient.RespInputStream.read(RespInputStream.java:155)

  at HTTPClient.Response.readResponseHeaders(Response.java:998)

  at HTTPClient.Response.getHeaders(Response.java:698)

  at HTTPClient.Response.getVersion(Response.java:290)

  at HTTPClient.HTTPConnection.sendRequest(HTTPConnection.java:3238)

  at HTTPClient.HTTPConnection.handleRequest(HTTPConnection.java:2882)

  at HTTPClient.HTTPConnection.setupRequest(HTTPConnection.java:2674)

  at HTTPClient.HTTPConnection.Get(HTTPConnection.java:985)

  at net.grinder.plugin.http.HTTPRequest$2.doRequest(HTTPRequest.java:509)

  at net.grinder.plugin.http.HTTPRequest$AbstractRequest.getHTTPResponse(HTTPRequest.java:1252)

  at net.grinder.plugin.http.HTTPRequest.GET(HTTPRequest.java:504)

  at net.grinder.plugin.http.HTTPRequest.GET(HTTPRequest.java:450)

  at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)

  at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)

  at org.python.core.PyObject.__call__(PyObject.java:404)

  at org.python.core.PyObject.__call__(PyObject.java:408)

  at org.python.core.PyMethod.__call__(PyMethod.java:124)


Is there any way to control the number of retries performed by HTTPRequest? E.g. with HTTPPluginContol?

Philip Aston --->
OK, I've reproduced this.

It's not specific to HTTPS. The HTTPClient library tries up to 3 times to send a request if it doesn't understand why the exception it received. (See HTTPClient.HTTPConnection.sendRequest()).

I agree with you that we only want The Grinder to try once. However, its crufty old code, and I have to be careful not to make it worse.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks