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

Aleksandar Radulovic maurice.chavez at gmail.com
Fri Feb 20 14:56:04 CET 2009


Hi,

I am having a rather similar problem with my code (Stackless Python
2.6.1 on OSX).

My app (pyglet + stackless python) breaks with the same exception straight away.

If I run it on 2.5.2 version of Stackless Python the problem does not
appear, even after
several hours of running.

The exception looks like this:
Traceback (most recent call last):
  File "./proco.py", line 68, in <module>
    pyglet.app.run()
  File "build/bdist.macosx-10.3-i386/egg/pyglet/app/__init__.py", line
264, in run
  File "build/bdist.macosx-10.3-i386/egg/pyglet/app/carbon.py", line 84, in run
  File "build/bdist.macosx-10.3-i386/egg/pyglet/app/carbon.py", line
133, in _timer_proc
  File "build/bdist.macosx-10.3-i386/egg/pyglet/app/__init__.py", line
187, in idle
  File "build/bdist.macosx-10.3-i386/egg/pyglet/clock.py", line 696, in tick
  File "build/bdist.macosx-10.3-i386/egg/pyglet/clock.py", line 303, in tick
  File "./proco.py", line 44, in update
    self.broadcast.send(dt)
  File "/Users/alex/src/python/antfarm/engine/system.py", line 18, in send
    result = stackless.channel.send(self, value)
RuntimeError: maximum recursion depth exceeded while calling a Python object

As seen, the code uses BroadcastChannel idiom.

-alex.

On Tue, Feb 3, 2009 at 9:49 AM, Kristján Valur Jónsson
<kristjan at ccpgames.com> wrote:
> 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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
>



-- 
Pozdrav / Regards
Aleksandar




More information about the Stackless mailing list