[Stackless] Channel Balance Error

Kristján Valur Jónsson kristjan at ccpgames.com
Fri Feb 5 22:37:44 CET 2010


Well, channel.balance is one thing.  If you want further diagnostis, try figuring out what tasklets are waiting on the channel.
def ChannelTasklets(channel):
	first = t = channel.queue
	result = []
	while t:
		result.append(t)
		t = t.next
		if t is first: break
	return result

Also, be sure that your are using cooperative scheduling (not preemptive) by using stackless.run() without arguments in your mainline code.

Also, I didn't understand what you meant by the problem going away when you removed the weakref.  I saw no weakrefs in use there.

K

> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless-
> bounces at stackless.com] On Behalf Of Bot Tiger
> Sent: 5. febrúar 2010 19:39
> To: The Stackless Python Mailing List
> Subject: Re: [Stackless] Channel Balance Error
> 
> Yes I am sure. I went over this with stakkars by changing this:
> 
> self.read_channel.send(self.sock.recv(bytes))
> 
> to
> 
> r = self.sock.recv(bytes)
> print 'sock recv done'
> self.read_channel.send(r)
> 
> Also, sorry about the send. I meant that I could receive() from the
> channel..
> 
> (Pdb) f.f_locals['self'].read_channel.receive()
> recv end
> *** TaskletExit:
> 
> But now I realize that both send and receive both result in
> TaskletExit.
> 
> 2010/2/5 Kristján Valur Jónsson <kristjan at ccpgames.com>:
> > Are you sure that the tasklet isn't simply blocked in the
> self.sock.recv()?
> > channel balance is in all likelyhood not broken.  So much else would
> break if that were true.  And the fact that you could send() to the
> channel from gdb, shows that someone was listening.
> > K
> >
> >> -----Original Message-----
> >> From: stackless-bounces at stackless.com [mailto:stackless-
> >> bounces at stackless.com] On Behalf Of Bot Tiger
> >> Sent: 5. febrúar 2010 01:57
> >> To: stackless at stackless.com
> >> Subject: [Stackless] Channel Balance Error
> >>
> >> I was attempting to fix the pyevent stackless nonblocking socket
> module
> >> here:
> >>
> http://code.google.com/p/stacklessexamples/wiki/StacklessNonblockModule
> >> s
> >>
> >> I ran into a problem where the channel balance was incorrect. A
> >> threadlet is blocked trying to send on line 215 when the channel
> >> balance is -1. Using pdb and executing send unblocks the channel.
> When
> >> weakref was removed, the problem went away.
> >>
> >> Stakkars thought I should post on the mailing list so here it is.
> >>
> >> http://codepad.org/TWa68adr
> >
> > _______________________________________________
> > Stackless mailing list
> > Stackless at stackless.com
> > http://www.stackless.com/mailman/listinfo/stackless
> >
> 
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless





More information about the Stackless mailing list