[Stackless] web.py
Matt Provost
mprovost at termcap.net
Fri Jun 22 03:00:02 CEST 2007
On Thu, Jun 21, 2007 at 08:10:54AM +0000, Richard Tew wrote:
> What version of Stackless are you running? Is this on Windows, MacOS
> or what? Did you compile it yourself? Where did you obtain the source
> code from? Was it from the release25 branch or from the release25 tag,
> one of the 2.4.x branches, the trunk?
>
> To be honest, I would hazard a guess and assume the fact that the
> call stack claims tasklet_clear is on line 943 is an indication of problems
> with the version you compiled. It gets impl_tasklet_kill right. Do the
> Python unit tests and the Stackless unit tests all pass for you?
>
> Stackless when working on different platforms is pretty reliable in having
> the same bugs reproducible on whichever one is involved. The best
> scenario would be you being able to provide a reproducibility case.
>
OK I upgraded everything and now I can reproduce a hang. I compiled
2.5.1 from svn:
Python 2.5.1 Stackless 3.1b3 060516 (python-2.51:56057, Jun 21 2007, 22:30:19)
[GCC 3.4.3 20050227 (Red Hat 3.4.3-22.1)] on linux2
and grabbed the latest stacklesssocket (Although it doesn't seem that
the problem is with stacklesssocket).
Here's my sample code:
#!/usr/local/bin/stackless -u
import web
import stackless
urls = ('/', 'test')
class test():
def producer(self, ch):
for x in xrange(10):
ch.send(x)
web.debug('sent %i' % x)
def consumer(self, ch):
for x in xrange(10):
i = ch.receive()
print i
web.debug('got %i' % i)
def GET(self):
ch = stackless.channel()
stackless.tasklet(self.producer)(ch)
stackless.tasklet(self.consumer)(ch)
stackless.run()
web.debug('done!')
web.webapi.internalerror = web.debugerror
if __name__ == '__main__':
web.run(urls, globals(), web.reloader)
You save it to code.py and run it to get a web server listening on port
8080. Hitting that page in a browser works fine. But if you change the
producer to run more times than the consumer, (ie while i<11) then it
hangs. Running that code directly from an interpreter works fine in
either case. Both of them print out up until:
'got 9'
'sent 9'
on the server, but the one with the still running producer doesn't print
'done!', so it looks like it's stuck in stackless.run().
Another thing that I see is that when I control-c to quit, the hung
process doesn't get the KeyboardInterrupt and I have to kill the
process.
To me it looks like something doesn't like having live tasklets sticking
around, which is what my code does quite a lot of. Am I doing something
wrong? Now that I know where it is, I'll poke around in web.py and see
if anything obvious is going on.
Thanks,
Matt
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list