Re: [Grinder-use] Grinder Connection Timeouts
Distributed load testing framework - Java, Jython, or Clojure scripts.
Brought to you by:
philipa
|
From: Philip A. <ph...@ma...> - 2013-10-08 07:51:11
|
That's because you've added a "raise RuntimeError" line. Remove it from
Interrupter.
- Phil
On 07/10/13 12:36, Benedict Dodd wrote:
> 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) <http://grinder.sourceforge.net/g3/script-javadoc/net/grinder/plugin/http/HTTPPluginConnection.html#setTimeout%28int%29>
>>>
>>> 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
>>>
|