[Stackless] tasklet time out

Richard Tew richard.m.tew at gmail.com
Wed Feb 29 20:20:31 CET 2012


On Wed, Feb 29, 2012 at 11:06 PM, piyush singhai
<singhai.piyush at gmail.com> wrote:
> Now suppose one of the tasklet stuck in while true loop or infinite loop
> because of the code bug you can say. Then no other tasklet will get the turn
> to execute. I want to avoid this  scenario. I am trying to do using
> stackless.run(timeout) but this timeout is number of instruction.

You will have to make do with the instruction count timeout.  There is
no support for actual time-based timeouts.

In my experience the instruction count timeout has been perfectly fine
for this purpose.  When you are pumping the scheduler, the theory is
that tasklets spend most of their time outside of the scheduler
blocked on channels.  So the scheduler is expected to never block for
very long, time-wise or instruction count-wise.  Just decide on a low
enough instruction count and you should be fine, a bit of
experimentation should determine a suitable value.

In practice, I've never seen our infinite loop detection kick in.  I
know it definitely works, but infinite loops never happen in practice.

Cheers,
Richard.



More information about the Stackless mailing list