Hello,

(on JMeter 2.5.1RC1)
Don't retry automatically with HC4 sampler seems introduce a bug on load
tests using HC4.

When you run a load test, some errors "The target server failed to
respond" can appear on response data.

With wireshark, this error arrives at the end of TCP conversations: the
GET request is sent, but no server response (the connection has been
closed, I suppose).

If I changes the property httpclient4.retrycount to 3, the load tests
works fine, with no errors.

This bug is tested on Linux with JVM5/7 and WinXP with JVM7

Test case is the Simple Test Case on this bugs:
https://issues.apache.org/bugzilla/show_bug.cgi?id=51863

(Note: no errors with HC3.1)
(Questions: retrycount exists on HC3.1? if yes what default value?)

====Response data====
org.apache.http.NoHttpResponseException: The target server failed to respond
    at
org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101)
    at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
    at
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
    at
org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
    at
org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
    at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
    at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at
org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
    at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:265)
    at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
    at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1010)
    at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:996)
    at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:383)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:276)
    at java.lang.Thread.run(Thread.java:595)
=====================

Milamber

Le 01/09/2011 17:52, s...@apache.org a ecrit :
> Author: sebb
> Date: Thu Sep  1 17:52:41 2011
> New Revision: 1164186
>
> URL: http://svn.apache.org/viewvc?rev=1164186&view=rev
> Log:
> Don't automatically retry with HttpCLient4 sampler
>
> Modified:
>     jakarta/jmeter/trunk/bin/jmeter.properties
>     
> jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
>     jakarta/jmeter/trunk/xdocs/changes.xml
>     jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
>
> Modified: jakarta/jmeter/trunk/bin/jmeter.properties
> URL: 
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=1164186&r1=1164185&r2=1164186&view=diff
> ==============================================================================
> --- jakarta/jmeter/trunk/bin/jmeter.properties (original)
> +++ jakarta/jmeter/trunk/bin/jmeter.properties Thu Sep  1 17:52:41 2011
> @@ -251,7 +251,7 @@ log_level.jorphan=INFO
>  # 0 now means don't retry connection (in 2.3 and before it meant no tries at 
> all!)
>  
>  #---------------------------------------------------------------------------
> -# HTTPClient configuration
> +# Commons HTTPClient configuration
>  #---------------------------------------------------------------------------
>  
>  # define a properties file for overriding Commons HttpClient parameters
> @@ -302,7 +302,7 @@ log_level.jorphan=INFO
>  #log_file.httpclient=httpclient.log
>  
>  
> -#         Apache HttpClient logging examples
> +#         Apache Commons HttpClient logging examples
>  #
>  # Enable header wire + context logging - Best for Debugging
>  #log_level.org.apache.http=DEBUG
> @@ -320,6 +320,13 @@ log_level.jorphan=INFO
>  #log_level.org.apache.http.client=DEBUG
>  
>  #---------------------------------------------------------------------------
> +# Apache HttpComponents HTTPClient configuration (HTTPClient4)
> +#---------------------------------------------------------------------------
> +
> +# Number of retries to attempt (default 0)
> +#httpclient4.retrycount=0
> +
> +#---------------------------------------------------------------------------
>  # Results file configuration
>  #---------------------------------------------------------------------------
>  
>
> Modified: 
> jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
> URL: 
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1164186&r1=1164185&r2=1164186&view=diff
> ==============================================================================
> --- 
> jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
>  (original)
> +++ 
> jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
>  Thu Sep  1 17:52:41 2011
> @@ -50,6 +50,7 @@ import org.apache.http.auth.NTCredential
>  import org.apache.http.auth.UsernamePasswordCredentials;
>  import org.apache.http.client.CredentialsProvider;
>  import org.apache.http.client.HttpClient;
> +import org.apache.http.client.HttpRequestRetryHandler;
>  import org.apache.http.client.entity.UrlEncodedFormEntity;
>  import org.apache.http.client.methods.HttpDelete;
>  import org.apache.http.client.methods.HttpGet;
> @@ -74,6 +75,7 @@ import org.apache.http.entity.mime.conte
>  import org.apache.http.entity.mime.content.StringBody;
>  import org.apache.http.impl.client.AbstractHttpClient;
>  import org.apache.http.impl.client.DefaultHttpClient;
> +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
>  import org.apache.http.message.BasicNameValuePair;
>  import org.apache.http.params.BasicHttpParams;
>  import org.apache.http.params.CoreConnectionPNames;
> @@ -109,6 +111,9 @@ public class HTTPHC4Impl extends HTTPHCA
>  
>      private static final Logger log = LoggingManager.getLoggerForClass();
>  
> +    /** retry count to be used; defaults to 0 = disable retries */
> +    private static final int RETRY_COUNT = 
> JMeterUtils.getPropDefault("httpclient4.retrycount", 0);
> +
>      private static final String CONTEXT_METRICS = "jmeter_metrics"; // TODO 
> hack, to be removed later
>  
>      private static final HttpResponseInterceptor METRICS_SAVER = new 
> HttpResponseInterceptor(){
> @@ -447,7 +452,12 @@ public class HTTPHC4Impl extends HTTPHCA
>  
>              HttpParams clientParams = new DefaultedHttpParams(new 
> BasicHttpParams(), DEFAULT_HTTP_PARAMS);
>              
> -            httpClient = new DefaultHttpClient(clientParams);
> +            httpClient = new DefaultHttpClient(clientParams){
> +                @Override
> +                protected HttpRequestRetryHandler 
> createHttpRequestRetryHandler() {
> +                    return new DefaultHttpRequestRetryHandler(RETRY_COUNT, 
> false); // set retry count
> +                }
> +            };
>              ((AbstractHttpClient) httpClient).addResponseInterceptor(new 
> ResponseContentEncoding());
>              ((AbstractHttpClient) 
> httpClient).addResponseInterceptor(METRICS_SAVER); // HACK
>              
>
> Modified: jakarta/jmeter/trunk/xdocs/changes.xml
> URL: 
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1164186&r1=1164185&r2=1164186&view=diff
> ==============================================================================
> --- jakarta/jmeter/trunk/xdocs/changes.xml (original)
> +++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Sep  1 17:52:41 2011
> @@ -60,6 +60,9 @@ To override the default local language f
>  <h2>Incompatible changes</h2>
>  
>  <p>
> +The HttpClient4 sampler as implemented in version 2.5 used a retry count of 
> 3.
> +As this can hide server errors, JMeter now sets the retry count to 0 to 
> prevent any automatic retries.
> +This can be overridden by setting the JMeter property 
> <b>httpclient4.retrycount</b>.
>  </p>
>  
>  <h2>Bug fixes</h2>
> @@ -67,6 +70,7 @@ To override the default local language f
>  <h3>HTTP Samplers and Proxy</h3>
>  <ul>
>  <li>Bug 51750 - Retrieve all embedded resources doesn't follow IFRAME</li>
> +<li>Change the default so the HttpClient 4 sampler does not retry</li>
>  </ul>
>  
>  <h3>Other Samplers</h3>
>
> Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
> URL: 
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1164186&r1=1164185&r2=1164186&view=diff
> ==============================================================================
> --- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
> +++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Thu Sep  1 
> 17:52:41 2011
> @@ -93,7 +93,7 @@ Latency is set to the time it takes to l
>          <li>applets</li>
>          <li>stylesheets</li>
>          <li>external scripts</li>
> -        <li>frames</li>
> +        <li>frames, iframes</li>
>          <li>background images (body, table, TD, TR)</li>
>          <li>background sound</li>
>          </ul>
> @@ -353,6 +353,12 @@ Optional properties to allow change the 
>  <note>Versions of JMeter before 2.5 returns only data response size 
> (uncompressed if request uses gzip/defate mode).
>  <br></br>To return to settings before version 2.5, set the two properties to 
> false.</note>
>  </p>
> +<p>
> +<b>Retry handling</b><br></br>
> +In version 2.5 of JMeter, the HttpClient4 sampler used the default retry 
> count, which was 3.
> +As this can hide server errors, JMeter now sets the retry count to 0 to 
> prevent any automatic retries.
> +This can be overridden by setting the JMeter property 
> <b>httpclient4.retrycount</b>.
> +</p>
>  <links>
>          <link href="test_plan.html#assertions">Assertion</link>
>          <link href="build-web-test-plan.html">Building a Web Test Plan</link>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org
> For additional commands, e-mail: notifications-h...@jakarta.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: dev-h...@jakarta.apache.org

Reply via email to