Re: Grinder Connection Timeouts
Benedict Dodd <[email protected]>
| Newsgroups | gmane.comp.java.grinder.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Phil,
Thank you for both your clarification and the coding example.
I am, however, unable to get the example working. It seems that the example below, or at least how I've implemented it, only interrupts the timer thread and not the thread making the request, no?
Using this:
class Interrupter(TimerTask):
def __init__(self):
self.t = Thread.currentThread()
def run(self):
self.t.interrupt()
raise RuntimeError('Timed Out!')
And this
def timeout_fail(self):
t = Timer()
t.schedule(Interrupter(), 4000)
request101 = HTTPRequest(url=URL_MOCK, headers=headers0)
result = request101.GET('/sleep/10000')
t.cancel()
I get this:
Exception in thread "Timer-2" Traceback (most recent call last):
File "lib/common.py", line 100, in run
raise RuntimeError('Timed Out!')
RuntimeError: Timed Out!
Thanks, as ever, for your help, Ben
On Sunday, 6 October 2013 at 17:28, Philip Aston wrote:
> 1. Yes.
>
> 2. Code a timeout yourself. Here's a hint
>
> > from java.util import Timer, TimerTask
> > from java.lang import Thread, InterruptedException
> >
> > t = Timer(True)
> >
> > class Interrupter(TimerTask):
> > def __init__(self):
> > self.t =Thread.currentThread()
> >
> > def run(self):
> > self.t.interrupt()
> >
> > t.schedule(Interrupter(), 1000)
> >
> > try:
> > Thread.sleep(2000)
> > print "Slept through the night"
> > except InterruptedException:
> > print "Rudely interrupted"
> 3. See #2.
>
>
> HTH,
>
> - Phil
>
>
> On 01/10/13 19:20, Benedict Dodd wrote:
> > Hello Grind-a-trons I'd been under the impression that setting a connection timeout would curtain all connections at the set limit. However, if I'm reading this correctly, it will continue past the set value as long as the remote server is trickling data back: http://grinder.sourceforge.net/g3/script-javadoc/net/grinder/plugin/http/HTTPPluginConnection.html#setTimeout(int) 1. Is that correct? 2. Is there a good way to put a hard limit on a request time? 3. Is there a good way to catch timeout exceptions? Thanks, Ben
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
>
> _______________________________________________
> grinder-use mailing list
> [email protected] (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use