[Twisted-Python] Maximum Recursion Depth Error with Twisted 8.2/Stackless 2.6.1

Andrew Francis andrewfr_ice at yahoo.com
Mon Feb 2 17:47:47 EST 2009


Hi Colleagues:

I recently updated to Stackless 2.6.1 and Twisted 8.2. I executed the following programme that works fine under Stackless 2.5.2 and Twisted (including 8.2) and I received the following error:

traceback (most recent call last):
          File "ToyProcessor5.py", line 60, in twistedReactor
            reactor.run()
          File "/usr/local/lib/python2.6/site-packages/twisted/internet/base.py"
, line 1048, in run
            self.mainLoop()
        --- <exception caught here> ---
          File "/usr/local/lib/python2.6/site-packages/twisted/internet/base.py"
, line 1057, in mainLoop
            self.runUntilCurrent()
          File "/usr/local/lib/python2.6/site-packages/twisted/internet/base.py"
, line 707, in runUntilCurrent
            log.deferr()
          File "/usr/local/lib/python2.6/site-packages/twisted/python/log.py", l
ine 153, in err
            _stuff = failure.Failure()
          File "/usr/local/lib/python2.6/site-packages/twisted/python/failure.py
", line 265, in __init__
            parentCs = reflect.allYourBase(self.type)
", line 542, in allYourBase
            accumulateBases(classObj, l, baseClass)
          File "/usr/local/lib/python2.6/site-packages/twisted/python/reflect.py", line 550, in accumulateBases
            accumulateBases(base, l, baseClass)
          File "/usr/local/lib/python2.6/site-packages/twisted/python/reflect.py", line 550, in accumulateBases
            accumulateBases(base, l, baseClass)
          File "/usr/local/lib/python2.6/site-packages/twisted/python/reflect.py", line 550, in accumulateBases
            accumulateBases(base, l, baseClass)
          File "/usr/local/lib/python2.6/site-packages/twisted/python/reflect.py", line 550, in accumulateBases
            accumulateBases(base, l, baseClass)
        exceptions.RuntimeError: maximum recursion depth exceeded

Similarily written programmes fail in the same fashion. What is suspicious is that there is no recursion in the offending section. Even if I create one worker tasklet, I get the same error.

def twistedReactor():
    l = task.LoopingCall(stackless.schedule)
    l.start(.01)
    reactor.run()

however, if I change

l = task.LoopingCall(stackless.schedule)

to

l = task.LoopingCall(tick)

and tick is

def tick():
    stackless.schedule()

the programme works. Although a work around, I would like to find the real problem.

What particular worries me is when I created small test examples, I was not  able to recreate the problem. Something else is going on....

What I would appreciate is some hints as to what may be happening.  

- I normally don't expect "Maximum Recursion Depth" errors in Stackless. 
- What is the reflect.allYourBases stuff? 
- What is log.deferr? (I don't recall seeing that method).

If I get few clues, it would make it easier for me to write new tests and zero in on the problem. Hopefully the problem is with my code rather than Stackless 2.6.1 and/or Twisted 8.2

I have included some sample code. Unfortunately ToyProcessor5.py is a bit large (I have newer code that is smaller but requires more files)

Cheers,
Andrew












      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ToyProcessor5.py
Type: text/x-python
Size: 13450 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20090202/8ecf9fca/attachment.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bad.py
Type: text/x-python
Size: 1486 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20090202/8ecf9fca/attachment-0001.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Good.py
Type: text/x-python
Size: 1444 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20090202/8ecf9fca/attachment-0002.py 


More information about the Twisted-Python mailing list