From dev-return-2078-apmail-jmeter-dev-archive=jmeter.apache.org@jmeter.apache.org Sun Jun 9 13:42:48 2013 Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7D0C210925 for ; Sun, 9 Jun 2013 13:42:48 +0000 (UTC) Received: (qmail 58131 invoked by uid 500); 9 Jun 2013 13:42:48 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 58111 invoked by uid 500); 9 Jun 2013 13:42:48 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 58103 invoked by uid 99); 9 Jun 2013 13:42:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Jun 2013 13:42:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of philippe.mouawad@gmail.com designates 209.85.223.171 as permitted sender) Received: from [209.85.223.171] (HELO mail-ie0-f171.google.com) (209.85.223.171) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Jun 2013 13:42:42 +0000 Received: by mail-ie0-f171.google.com with SMTP id s9so14448362iec.16 for ; Sun, 09 Jun 2013 06:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=qbNYP+NAJXUJF5BIBV7bhwEz1mlfZ+7CmJW0hYnRweY=; b=p6QUi0if3oB1wqUWXait1jXxRGdBCKkAshgxxQChCsiMI0KqjNR2gT5/yIxUItpkBn 9MGrHpWMkwGBg5JXT6AIm3hNYgS2+f7Qj2B+wbLsNXLR9DXwWj0srPF1uWQU19BC1nDb 0ocZbEGmp5U7CP9m5strU4JnjBf2fbxLZdJH7lCgVsBsSR7SnMhBkeSK79CehLvgpGGm CgWnTDyjWV6zF7a7ojadKH9R+lCxP1kmT7H6HlScmEX9pkUWn7CXutawEuzdFxPgiEMJ YRyo5wxG8jvXTjewvzJTeT5EdAXAnYB4A3GJp98xuhKN3RgMGCjPbuCzmyDTsJe7WwRj s1kQ== MIME-Version: 1.0 X-Received: by 10.43.146.3 with SMTP id jw3mr2371135icc.39.1370785341997; Sun, 09 Jun 2013 06:42:21 -0700 (PDT) Received: by 10.42.88.194 with HTTP; Sun, 9 Jun 2013 06:42:21 -0700 (PDT) In-Reply-To: References: <20130606134303.0807F2388900@eris.apache.org> Date: Sun, 9 Jun 2013 15:42:21 +0200 Message-ID: Subject: Re: svn commit: r1490281 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java From: Philippe Mouawad To: dev@jmeter.apache.org Content-Type: multipart/alternative; boundary=001a11c2e9aa5f8b1904deb8d54c X-Virus-Checked: Checked by ClamAV on apache.org --001a11c2e9aa5f8b1904deb8d54c Content-Type: text/plain; charset=ISO-8859-1 I think I fixed the issue , please review. Thanks On Fri, Jun 7, 2013 at 1:40 AM, sebb wrote: > On 7 June 2013 00:23, sebb wrote: > > On 6 June 2013 20:55, Philippe Mouawad > 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 ? > > > > There was NPE in HTTPSamplerBase#errorResult on the line > > > > e.printStackTrace(new PrintStream(text)); > > > > because e was null > > > >> For me it's the same thread which calls testIterationStart and sample ? > > > > No, it's a different thread. > > Actually, normally testIterationStart is called by the same thread as > sampler. > > However the test case Bug52310.jmx was failing because of NPE (as > above) and I think this is caused by sample running in a different > thread with a different instance. > > >> I would like to understand what was wrong in the code I commited. > >> > >> Thanks for clarifications. > > This problem was first picked up by Jenkins. > > >> Regards > >> Philippe > >> > >> On Thu, Jun 6, 2013 at 3:43 PM, 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. --001a11c2e9aa5f8b1904deb8d54c--