[Stackless] Blocking Problem with Stackless Python and Twisted

Bob Ippolito bob at redivi.com
Thu Jun 15 21:34:45 CEST 2006

On Jun 15, 2006, at 11:47 AM, Andrew Francis wrote:

> I wrote a test programme that acts both as a web
> server and a web client. Some tasklets make HTTP
> requests. Other tasklets service incoming HTTP
> requests.
> My problem is that is that my code is sensitive to the
> order of processing client and server requests. If a
> tasklet acting as a cgi script (server) is called
> first, everything else will block until I send the
> test programme a HTTP request. Given the way the code
> is written, I was not expecting this.
> My sneaking suspicion is that Twisted itself is
> blocked. Off hand I don't know if Requests are
> initiated as deferred objects. I am going through
> Twisted code. Meanwhile, I am hoping someone out there
> has insights. Thanks in advance.

Twisted isn't designed for Stackless integration, and the approach  
you're taking simply will not work.

Twisted does block on reactor.run(), and during each runloop  
iteration it blocks waiting for a timeout or network activity (via  
select or poll usually).

You might want to look at http://twistedmatrix.com/trac/browser/ 
sandbox/radix/threadless.py - but that kind of integration is very  
different from what you've attempted to do.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list