Looks like the connection is only being reused by the same sampler in
the same thread, rather than by all samplers in the same thread -
oops!

I think the httpConn variable needs to be saved in some thread-local
storage, e.g. use getThreadContext().getVariables() and put() / get()
the object using a key which is unique to the sampler.

I don't have time just now to fix it, but let me know later if you are stuck.

S.
On Wed, 23 Mar 2005 16:11:49 +0200, Kumar Krishnan (K)
<[EMAIL PROTECTED]> wrote:
> 
> Thanks - I've added the cookie manager - with the same result. I'm not
> sure why the installation's not complete - will look into this:
> 
> Here's a sample of the log with the cookie manager added: (I've added
> some logging in the setupConnection method - clearly for the second
> request - the connection is reset).
> 
> 2005/03/23 16:07:15 INFO  - jmeter.threads.JMeterThread: Thread
> createService 1-1 started
> 2005/03/23 16:07:15 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Thread Started
> 2005/03/23 16:07:15 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Thread Started
> 2005/03/23 16:07:15 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> RESETTING connection
> 2005/03/23 16:07:15 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> httpConnection is NULL.
> 2005/03/23 16:07:15 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method  : setConnectionAuthorization
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method : saveConnectionCookies
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Cookie manager is not null.
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Another Cookie :
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> ASP.NET_SessionId
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In setupConnection
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> NOT resetting connection
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method  : setConnectionAuthorization
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method : saveConnectionCookies
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Cookie manager is not null.
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In setupConnection
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> RESETTING connection
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> httpConnection is NULL.
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method  : setConnectionAuthorization
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> In Method : saveConnectionCookies
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Cookie manager is not null.
> 2005/03/23 16:07:16 INFO  - jmeter.threads.JMeterThread: Thread
> createService 1-1 is done
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Thread Finished
> 2005/03/23 16:07:16 INFO  - jmeter.protocol.http.sampler.HTTPSampler2:
> Thread Finished
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying listeners of end of test
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying test listener:
> org.apache.jmeter.protocol.http.sampler.HTTPSampler2
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying test listener:
> org.apache.jmeter.protocol.http.sampler.HTTPSampler2
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying test listener:
> org.apache.jmeter.protocol.http.control.CookieManager
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying test listener: org.apache.jmeter.reporters.ResultCollector
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine:
> Notifying test listener: org.apache.jmeter.gui.MainFrame
> 2005/03/23 16:07:16 INFO  - jmeter.gui.util.JMeterMenuBar:
> setRunning(false,local)
> 2005/03/23 16:07:16 INFO  - jmeter.engine.StandardJMeterEngine: Test
> has ended
> 
> Is there perhaps some global property / setting that I've failed to
> include?
> 
> -----Original Message-----
> From: sebb [mailto:[EMAIL PROTECTED]
> Sent: 23 March 2005 04:05 PM
> To: Kumar Krishnan (K)
> Subject: Re: HTTPSampler2 - Using the same thread
> 
> Looks like the JMeter installation is incomplete - there are some
> errors in the log file.
> 
> Also, you haven't added a Cookie Manager, which is needed if you want
> to use Cookies.
> 
> Add one to the Thread Group.
> 
> Sebastian
> On Wed, 23 Mar 2005 15:52:30 +0200, Kumar Krishnan (K)
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi Sebb -
> >
> > Thanks!
> >
> > Please find the log and the jmeter test attached - I've added some
> > other logging info...
> >
> > Kind Regards
> > Kumar
> >
> > -----Original Message-----
> > From: sebb [mailto:[EMAIL PROTECTED]
> > Sent: 23 March 2005 03:48 PM
> > To: Kumar Krishnan (K)
> > Cc: JMeter Users List
> > Subject: Re: HTTPSampler2 - Using the same thread
> >
> > It's not supposed to start a new thread for each request, and
> > httpsampler2 is supposed to honour the keep-alive setting.
> >
> > Can you send me a sample script (cleaned of any private information)
> 
> > and I'll have a look.
> >
> > Sebastian
> > On Wed, 23 Mar 2005 15:40:00 +0200, Kumar Krishnan (K)
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi Guys -
> > >
> > > Apologies if this is a fairly basic question...
> > >
> > > I'm trying to use the HTTPSampler - that uses httpclient - I've
> > > modified the code a bit to get NTLM authentication working.
> > >
> > > The website I'm trying to access is of the form:
> > >
> > > - login
> > > - (obtain a cookie)
> > > - do some other stuff
> > >
> > > The problem I'm having is that each sampler seems to create a new
> > > instance of the httpclient for every request - in the jmeter.log
> > there
> > > is a 'Thread started" for every http request - this is not what I
> > want
> > > (this in turn seems open a dedicated http connection - and so
> > session
> > > information is lost). Is there a way that I can prevent jmeter
> from
> > > creating new instances of httpclient and httpconnection for every
> > http
> > > request?
> > >
> > > Any help would be much appreciated.
> > >
> > > PS - for anyone interested in getting NTLM authentication going,
> > I've
> > > changed the following (this is not the best way - because it
> always
> > > assumes ntlm authentication, and the username / password is
> > hardcoded
> > > - but it's a start):
> > >
> > >     private void setConnectionAuthorization(
> > >         HttpMethod method,
> > >         URL u,
> > >         AuthManager authManager)
> > >     {
> > >
> > >                 NTCredentials upc =     new NTCredentials(<insert
> > > username here>, <insert password here>,"localhost",<insert domain
> > > here>);
> > >         httpState.setCredentials(null,null, upc );
> > >     }
> > >
> > > ==================================================================
> > > This e-mail and its contents are subject to the Telkom SA Limited
> > > e-mail legal notice available at
> > > http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
> > >
> >
> > ==================================================================
> > This e-mail and its contents are subject to the Telkom SA Limited
> > e-mail legal notice available at
> > http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
> >
> >
> 
> ==================================================================
> This e-mail and its contents are subject to the Telkom SA Limited
> e-mail legal notice available at
> http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to