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

Kristján Valur Jónsson kristjan at ccpgames.com
Tue Feb 3 10:49:17 CET 2009


Stackless does stack copying if it senses that the C stack has grown to deep.  But it still tries to maintain the recursion depth limit set in "sys".  There is probably a bug somewhere in the bookkeeping of this.
I'll try trawling through the code for the corresponding stuff If I find the time today.
K

-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Andrew Francis
Sent: 2. febrúar 2009 22:48
To: twisted-python at twistedmatrix.com
Cc: stackless at stackless.com
Subject: [Stackless] Maximum Recursion Depth Error with Twisted 8.2/Stackless 2.6.1

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












      




More information about the Stackless mailing list