From dev-return-2074-apmail-jmeter-dev-archive=jmeter.apache.org@jmeter.apache.org Thu Jun 6 23:41:19 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 6F266101ED for ; Thu, 6 Jun 2013 23:41:19 +0000 (UTC) Received: (qmail 73015 invoked by uid 500); 6 Jun 2013 23:41:19 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 72949 invoked by uid 500); 6 Jun 2013 23:41:19 -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 72941 invoked by uid 99); 6 Jun 2013 23:41:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 23:41:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebbaz@gmail.com designates 209.85.212.178 as permitted sender) Received: from [209.85.212.178] (HELO mail-wi0-f178.google.com) (209.85.212.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 23:41:12 +0000 Received: by mail-wi0-f178.google.com with SMTP id k10so855419wiv.11 for ; Thu, 06 Jun 2013 16:40:52 -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=gBekJKjj3RCxu+Xh9uDd8WPO2rJoS1NrlT1kH5I2Ejk=; b=RqzFXg/GhuvK9ebqvj+wREwzGMXKCu1pBywEJSxfigfouWRALZwgEAmJcH0LAO33H1 lY3N/w3zlNznz08Yw+JkRzG06nqP2OsrHYH/QpkA45ujS3GvgJOdrlc31JgSl4JG+pyu 0m21xyQ7n+DMJHtQXRkpHmbuzbQjqKvNWh/8cf+TjRXuj0Ab4KzzcUkE3TnjmqjDySjx yD5IM2DdHsEcDe7ogx8yWhxaHF+CKWLqe5F6fsRUcu+JV1kLgl7BbRLpH3C1jbIcqPEF WBL5KX1BVM4dwe1Cfd1OCWoFieT1NL7GqMfLS4vo62Icv35U/xE68YBb9yPTK7o4IBHA Nh/A== MIME-Version: 1.0 X-Received: by 10.194.219.198 with SMTP id pq6mr33654086wjc.58.1370562052121; Thu, 06 Jun 2013 16:40:52 -0700 (PDT) Received: by 10.194.43.164 with HTTP; Thu, 6 Jun 2013 16:40:52 -0700 (PDT) In-Reply-To: References: <20130606134303.0807F2388900@eris.apache.org> Date: Fri, 7 Jun 2013 00:40:52 +0100 Message-ID: Subject: Re: svn commit: r1490281 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java From: sebb To: dev@jmeter.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 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.