jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1490281 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
Date Thu, 06 Jun 2013 23:24:55 GMT
On 6 June 2013 21:18, Philippe Mouawad <philippe.mouawad@gmail.com> wrote:
> I am sorry sebb, I tested newly commited code and it's broken for me.
>

Well, we need a test case for this then.

> Set this in user.properties:
> https.use.cached.ssl.context=false
>
>
> And you will see
> HTTPHC3Impl#resetSSLContext is always false
> HTTPHC4Impl#resetSSLContext is always false
>
> This is because you create a new instance in sample method.

> So this reintroduces the regression on 51380
>
> Regards
> Philippe
> On Thu, Jun 6, 2013 at 9:55 PM, Philippe Mouawad <philippe.mouawad@gmail.com
>> wrote:
>
>> Hello sebb,
>> I don't understand your change.
>>
>> What do you mean by:
>>
>> +            // This class is cloned per thread, and testIterationStart is
>> called from a different thread from samplers
>> +            // so we need to fetch the implementation separately
>>
>> What is the regression introduced by my commit ?
>>
>> For me it's the same thread which calls testIterationStart and sample ?
>> I would like to understand what was wrong in the code I commited.
>>
>> Thanks for clarifications.
>> Regards
>> Philippe
>>
>>
>> On Thu, Jun 6, 2013 at 3:43 PM, <sebb@apache.org> wrote:
>>
>>> Author: sebb
>>> Date: Thu Jun  6 13:43:02 2013
>>> New Revision: 1490281
>>>
>>> URL: http://svn.apache.org/r1490281
>>> Log:
>>> Fix bug introduced in http://svn.apache.org/r1489603
>>> The testIterationStart method is called from a different thread from any
>>> of the samples
>>>
>>> Modified:
>>>
>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
>>>
>>> Modified:
>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
>>> URL:
>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java?rev=1490281&r1=1490280&r2=1490281&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
>>> (original)
>>> +++
>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
>>> Thu Jun  6 13:43:02 2013
>>> @@ -36,8 +36,6 @@ public final class HTTPSamplerProxy exte
>>>
>>>      private transient HTTPAbstractImpl impl;
>>>
>>> -    private transient Exception initException;
>>> -
>>>      public HTTPSamplerProxy(){
>>>          super();
>>>      }
>>> @@ -55,11 +53,14 @@ public final class HTTPSamplerProxy exte
>>>      /** {@inheritDoc} */
>>>      @Override
>>>      protected HTTPSampleResult sample(URL u, String method, boolean
>>> areFollowingRedirect, int depth) {
>>> -        if(impl != null) {
>>> -            return impl.sample(u, method, areFollowingRedirect, depth);
>>> -        } else {
>>> -            return errorResult(initException, new HTTPSampleResult());
>>> +        if (impl == null) { // Not called from multiple threads, so this
>>> is OK
>>> +            try {
>>> +                impl =
>>> HTTPSamplerFactory.getImplementation(getImplementation(), this);
>>> +            } catch (Exception ex) {
>>> +                return errorResult(ex, new HTTPSampleResult());
>>> +            }
>>>          }
>>> +        return impl.sample(u, method, areFollowingRedirect, depth);
>>>      }
>>>
>>>      // N.B. It's not possible to forward threadStarted() to the
>>> implementation class.
>>> @@ -85,17 +86,13 @@ public final class HTTPSamplerProxy exte
>>>       */
>>>      @Override
>>>      public void testIterationStart(LoopIterationEvent event) {
>>> -        if (impl == null) { // Not called from multiple threads, so this
>>> is OK
>>> -            try {
>>> -                impl =
>>> HTTPSamplerFactory.getImplementation(getImplementation(), this);
>>> -                initException=null;
>>> -            } catch (Exception ex) {
>>> -                initException = ex;
>>> -            }
>>> -        }
>>> -        if(impl != null) {
>>> +        try {
>>> +            // This class is cloned per thread, and testIterationStart
>>> is called from a different thread from samplers
>>> +            // so we need to fetch the implementation separately
>>> +            HTTPAbstractImpl temp =
>>> HTTPSamplerFactory.getImplementation(getImplementation(), this);
>>>              // see
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51380
>>> -            impl.testIterationStart(event);
>>> +            temp.testIterationStart(event);
>>> +        } catch (Exception ex) {
>>>          }
>>>      }
>>>  }
>>>
>>>
>>>
>>
>>
>> --
>> Cordialement.
>> Philippe Mouawad.
>>
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Mime
View raw message