[Stackless] Debugging Tasklets
Simon Pickles
sipickles at googlemail.com
Sat May 24 14:53:14 CEST 2008
Hi,
I have a subtle bug in my applications which is probably a good thing!
Its made me dig deeper into stackless.
My problem basically consists of an object which launches an update
infinite loop in a tasklet, scheduling each time:
class MyObject:
def __init__(self):
self.updater = stackless.tasklet(self.Update)()
def Update(self):
while 1:
#do stuff
stackless.schedule()
This works fine, however I get to a certain point. The Objects Update
loop is no longer called. Using breakpoints I can see that the objects
updater member is still the same, Its just not being schdeuled.
Can anyone advise me how I can track down what has happened to the tasklet?
Lookng through help(stackless), I have tried 'blocked':
>>>print self.Updater.blocked
False
I tried:
for m in map (stackless.get_thread_info, stackless.threads):
print m
This prints the list of tasklests in the scheduler, right? So why can I
not see the Updater tasklet in it, even before the subtle bug appears?
I added a callback too:
def Switch(prev, next):
print "SWITCH:::: %s, %s" % (prev, next)
if prev == None:
print "Main startup"
if next == None:
print "Dying..."
return
stackless.set_schedule_callback(Switch)
From this I can see the chain of tasklets being switched. These
addresses don't tally with the mapped list above tho, either. I'd
understand if blocked tasklets were not appearing in the scheduler list,
but these tasklets are shown to be scheduled by the callback.
Sorry if its a confused post. I am!
Thanks
Simon
More information about the Stackless
mailing list