Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPHC3Client uses a default retry count of 3, make it configurable #2561

Closed
asfimport opened this issue Sep 23, 2011 · 4 comments
Closed

HTTPHC3Client uses a default retry count of 3, make it configurable #2561

asfimport opened this issue Sep 23, 2011 · 4 comments

Comments

@asfimport
Copy link
Collaborator

@pmouawad (Bug 51882):
Add a property named :
#httpclient3.retrycount=0

to enable configuring Retry count which will now default to 0 (no retry)

Regards
Philippe Mouawad

OS: All

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Created attachment BUG_51880.patch: Fix to issue

BUG_51880.patch
Index: src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
===================================================================
--- src/core/org/apache/jmeter/engine/StandardJMeterEngine.java	(revision 1174430)
+++ src/core/org/apache/jmeter/engine/StandardJMeterEngine.java	(working copy)
@@ -570,9 +570,11 @@
      * </ul> 
      */
     private void stopAllThreads() {
-        // ConcurrentHashMap does not need synch. here
-        for (JMeterThread item : allThreads.keySet()) {
-            item.stop();
+        for (Iterator<Map.Entry<JMeterThread, Thread>> iterator = allThreads.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry<JMeterThread, Thread> entry = iterator.next();
+            entry.getKey().stop();
+            // 51880
+            entry.getValue().interrupt();
         }
     }
 

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Created attachment ISSUE_51882.patch: Fix to issue

ISSUE_51882.patch
Index: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
===================================================================
--- src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java	(revision 1174132)
+++ src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java	(working copy)
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.zip.GZIPInputStream;
 
+import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
@@ -87,6 +88,8 @@
 public class HTTPHC3Impl extends HTTPHCAbstractImpl {
 
     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("httpclient3.retrycount", 0);
 
     private static final String HTTP_AUTHENTICATION_PREEMPTIVE = "http.authentication.preemptive"; // $NON-NLS-1$
 
@@ -439,6 +442,8 @@
         if ( httpClient == null )
         {
             httpClient = new HttpClient(new SimpleHttpConnectionManager());
+            httpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
+                    new DefaultHttpMethodRetryHandler(RETRY_COUNT, false));
             if (log.isDebugEnabled()) {
                 log.debug("Created new HttpClient: @"+System.identityHashCode(httpClient));
             }
Index: bin/jmeter.properties
===================================================================
--- bin/jmeter.properties	(revision 1174675)
+++ bin/jmeter.properties	(working copy)
@@ -330,6 +330,9 @@
 # Number of retries to attempt (default 0)
 #httpclient4.retrycount=0
 
+# Number of retries to attempt (default 0)
+#httpclient3.retrycount=0
+
 #---------------------------------------------------------------------------
 # Results file configuration
 #---------------------------------------------------------------------------

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Test case that uses HTTPHC3.
Same test case as issue 51863 to show the error also occurs with HTTPHC3 when retry is set to 0.
Regards
Philippe Mouawad

Created attachment SimpleTest.jmx: Test Case that shows error when retry is set to 0

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Thanks!

I've applied the patch, but changed the default to 3 for compatibility.

We can easily change this later.

URL: http://svn.apache.org/viewvc?rev=1174767&view=rev
Log:
#2561 - HTTPHC3Client uses a default retry count of 3, make it configurable

Modified:
jakarta/jmeter/trunk/bin/jmeter.properties
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
jakarta/jmeter/trunk/xdocs/changes.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant