[Twisted-Python] Deferreds vs sys.getrecursionlimit()

Werner Thie wthie at thiengineering.ch
Tue Nov 18 01:39:50 MST 2008


Just to add my 2cts:

a quick solution to the problem is using stackless and setting 
sys.setrecursionlimit(sys.maxint). Your test code runs no problem with

            :
for i in range(100000):
     d.addCallback(fire, i)
            :

on a lousy Athlon dualcore with stackless compiled in:

Python 2.5.2 Stackless 3.1b3 060516 (release25-maint, Sep 26 2008, 
10:22:13) [MSC v.1310 32 bit (Intel)] on win32

For more than a year now I'm using stackless for all my Python projects 
without resorting to tasklets and the stuff stackless is really aiming 
at. I do so because getting rid of the C-stack is a major point in 
modern language design and implementation and in my opinion Python lags 
somewhat in this particular area.

It is of course true that one must be able to rebuild all the C based 
stuff you're using in a project but doing so is and was always at the 
center of my projects.

HTH, Werner


Brian Warner wrote:
> About once every six months, I wind up debugging a python stack
> overflow in my Deferred-using code. The symptom is usually a log
> message that ends with:
snip...




More information about the Twisted-Python mailing list