[Stackless] channel.balance wrong?!

Paul Sijben sijben at eemvalley.com
Sat Jul 11 10:37:17 CEST 2009


What I see in my trace is that tasklet A receives on a channel, some
time later (can look up an exact number of milliseconds but it was
several lines of debug output and some network communication later)
tasklet B checks the balance and finds it to be 0 (yet A is still waiting).

So no race contidtion there. :-(

Jeff Senn wrote:
> [unlikely that you haven't thought of this, but on the off-chance it
> helps;
> and because if channel->balance were ever broken I would expect a
> *lot* more to
> be wrong...]
>
> Are you doing "preemptive" scheduling?  Is there a race-condition
> where the balance is checked just prior to a receiver blocking?
> (this would be the classic all-consumer-busy-but-one-about-to-be-ready
> race condition you would only see under heavy load...)
>
> On Jul 10, 2009, at 10:48 AM, Paul Sijben 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?
>>
>> Paul
>>
>>
>> -- 
>> Paul Sijben                        tel: +31334566488
>> Eemvalley Technology BV           fax: +31334557523
>> the Netherlands                    http://eemvalley.com
>> -----------------------------------------------------
>> EemValley Technology werft python & wxpython
>> programmeurs: http://www.eemvalley.nl/jobs
>>
>>
>> _______________________________________________
>> Stackless mailing list
>> Stackless at stackless.com
>> http://www.stackless.com/mailman/listinfo/stackless
>>
>




More information about the Stackless mailing list