[Stackless] stackless inter-thread queues

Richard Tew richard.m.tew at gmail.com
Tue Mar 17 03:37:29 CET 2009

On Mon, Mar 16, 2009 at 10:16 AM, Paul Sijben <sijben at eemvalley.com> wrote:
> StopIteration('the main tasklet is receiving without a sender available.',)
> Initially I had simply caught it, I now uncommented that out and now
> commented that except out and found it does not like to be the only tasklet
> AND waiting on a channel. But since it is running in the second thread it
> will be revived anyway.
> Is there a way to prevent this exception from happening when there are
> multiple threads?

Hi Paul,

You definitely need to prevent this exception from happening.  Each
time it occurs, it means the main tasklet is being awoken from the
channel it is blocked on because there is nothing else to do.  Given
that it was blocked on that channel for a reason.. well, this may not
be the best thing for correct operation of an application.

It happens when:
1. The main tasklet is blocked on a channel.
2. There is one and only one tasklet in the scheduler and it is now exiting.

The scheduler needs to switch to another tasklet and there are none.
Whatever other tasklets on that thread exist, have to be blocked out
of the scheduler, whether on channels or whatever.  So, whether it
likes it or not, the main tasklet gets awakened.

So what to do?  The short answer is avoid this situation.  The long
answer is that perhaps this is a part of Stackless which needs to be
looked at to bring it into line with the recent "threadblock" changes.
 I'd need to discuss that with Kristjan Valur or Christian.


More information about the Stackless mailing list