Author: sebb
Date: Tue Sep 27 14:39:35 2011
New Revision: 1176404
URL: http://svn.apache.org/viewvc?rev=1176404&view=rev
Log:
More workrounds for HC4 bug
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
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=1176404&r1=1176403&r2=1176404&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
Tue Sep 27 14:39:35 2011
@@ -462,12 +462,30 @@ public class HTTPHC4Impl extends HTTPHCA
// can hopefully be removed when 4.1.3 or 4.2 are
released
@Override
public boolean retryRequest(IOException ex, int count,
HttpContext ctx) {
- HttpRequest request = (HttpRequest)
ctx.getAttribute(ExecutionContext.HTTP_REQUEST);
+ Object request =
ctx.getAttribute(ExecutionContext.HTTP_REQUEST);
if(request instanceof HttpUriRequest){
if (request instanceof RequestWrapper) {
request = ((RequestWrapper)
request).getOriginal();
}
if(((HttpUriRequest)request).isAborted()){
+ log.warn("Workround for HTTPCLIENT-1120
request retry: "+ex);
+ return false;
+ }
+ }
+ /*
+ * When connect fails due to abort, the request is
not in the context.
+ * Tried adding the request - with a new key - to
the local context in the sample() method,
+ * but the request was not flagged as aborted, so
that did not help.
+ * So we check for the specific exception that is
triggered.
+ */
+ if (ex instanceof java.net.BindException) {
+ /*
+ * This message is generated by aborted
connects.
+ * If it occurs in other situations, retrying
is unlikely to help,
+ * so preventing retry should not cause a
problem.
+ */
+ if (ex.getMessage().contains("Address already
in use: connect")){
+ log.warn("Workround for HTTPCLIENT-1120
connect retry: "+ex);
return false;
}
}
@@ -1085,7 +1103,7 @@ public class HTTPHC4Impl extends HTTPHCA
public boolean interrupt() {
HttpUriRequest request = currentRequest;
if (request != null) {
- currentRequest = null;
+ currentRequest = null; // don't try twice
try {
request.abort();
} catch (UnsupportedOperationException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]