[Stackless] channel.balance wrong?!
Chris Jacobson
mainecoon at gmail.com
Sat Jul 11 08:53:24 CEST 2009
I can think of at least one situation when this could occur, involving
Channel Preference of 1 (Sender):
Channel N is created with preference 1
Tasklet A and B start
Tasklet A runs, receives on N, and blocks
Tasklet B sees N has balance -1, so sends to N. Due to Preference, B will
not yield, instead A is placed at end of runnables queue. The channel's
balance is now 0.
Tasklet B continues running, sees N has a balance of 0, so does not send.
Repeat ad infinitum. Tasklet B never explicitly schedules or gets blocked
otherwise, and so A never wakes up.
On Fri, Jul 10, 2009 at 7:32 PM, Richard Tew <richard.m.tew at gmail.com>wrote:
> On Sat, Jul 11, 2009 at 2:48 AM, Paul Sijben<sijben at eemvalley.com> wrote:
> > I tracked down a bug in my code that occasionally popped up to
> > channel.balance being wrong sometimes.
> >
> > Some part of my code can not afford to block, so it checks the balance
> > wheter it should send something into the channel. If there is a receiver
> > waiting on it, that is fed by a send and the sender will not block. Now
> > I find that just occasionally the process stalls because there is a
> > receiver waiting but the sender does not send as channel.balance==0
> > instead of -1!
> >
> > I am running the current 2.6.2 version of stackless
> > (Python 2.6.2 Stackless 3.1b3 060516 (python-2.6.2:73804M, Jul 3 2009,
> > 11:33:51) )
> >
> > Is this issue known, and possibly solved in svn?
>
> This issue is not known. It is the first someone has even suggested
> it might be happening. During the eight years or so I was at C.C.P.,
> I never saw the likes of it.
>
> I would be inclined to believe that there was something wrong with
> your logic, rather than the channel code. And without a reproduction
> case, it is unlikely that it will ever be reproduced unfortunately.
>
> Cheers,
> Richard.
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090710/64d930ef/attachment.htm>
More information about the Stackless
mailing list