[Stackless] curl makes stackless wsgi die :(

jtunney at lobstertech.com jtunney at lobstertech.com
Mon Feb 2 10:05:12 CET 2009


Hello,

I wrote a small program that runs a simple WSGI server but it is  
silently dying after receiving a request from curl.  I used the  
stacklesswsgi.py module below and tested on both stackless 2.6.1 and  
2.5.2 (Mac OS)  You can reproduce this easily with the following code:

(get stacklesswsgi.py from http://code.google.com/p/stacklessexamples/wiki/StacklessWSGI 
  )

import stackless
def wsgi_app(environ, start_response):
     start_response('200 OK', [('Content-type', 'text/plain')])
     return ['hello kitty\n']
if __name__ == '__main__':
     import stacklesswsgi
     s = stacklesswsgi.Server(('127.0.0.1', 8080), wsgi_app)
     s.start()

This server works perfectly fine when sending requests from firefox,  
but if I send a request from curl:

$ curl http://localhost:8080/

The request is handled properly, and then the server dies,  
stackless.run() exits, and the program silently dies.  It seems the  
tasklet acting as the listening server dies when entering  
"self.accept_channel.receive()" (stacklesswsgi.py:171)  and receive()  
never returns.  receive doesn't raise an exception nor will it execute  
code wrapped into a 'finally' block.  I'm very new to stackless so I  
want to refrain from making too assumptions, but a 'finally' block not  
being executed might indicate a bug in the interpreter.

Also the asyncore tasklet continues running even after the server  
tasklet dies.

After spending a couple hours troubleshooting and googling, I am  
totally out of ideas.  Any help would be greatly appreciated!




More information about the Stackless mailing list