Problem with pypy-c and stacklesssocket.py
Hi Folks: I was testing a simple echoserver with stackless python 2.5.2 and pypy-c. I am running Ubuntu 9.04 and I compiled pypy-c with --stackless and optimization level 1. Under stackless python, the echoserver executes correctly. Under pypy-c, the server runs a while before I get: _scheduler_switch(curr, task) File "/home/andrew/lab/pypy-dist/pypy/lib/stackless.py", line 156, in _scheduler_switch next.switch() File "/home/andrew/lab/pypy-dist/pypy/lib/stackless.py", line 452, in _func func(*argl, **argd) File "/home/andrew/lab/pypy-dist/lib-python/2.5.2/stacklesssocket.py", line 77, in ManageSockets asyncore.poll(0.05) File "/home/andrew/lab/pypy-dist/lib-python/2.5.2/asyncore.py", line 109, in poll is_r = obj.readable() ReferenceError: weakly referenced object no longer exists I am using the stacklesssocket.py from http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/stackl... I have also enclosed the echoserver.py and a small test driver.py written with Twisted. I believe one can also use the drivers that come with the Beazley talk: http://www.dabeaz.com/coroutines/blaster.py Meanwhile I am looking over stacklesssocket.py to understand the logic. That said, any suggestions would be appreciated. Cheers, Andrew
Hi Andrew, On Fri, Oct 30, 2009 at 10:36:54AM -0700, Andrew Francis wrote:
File "/home/andrew/lab/pypy-dist/lib-python/2.5.2/asyncore.py", line 109, in poll is_r = obj.readable() ReferenceError: weakly referenced object no longer exists
I am afraid that you will not get much answers, mostly because we are not into developing or supporting the Stackless modules right now. However the problem does not seem Stackless-oriented, but just a misuse of reference counting. You get obviously a weak proxy object, so the question is who made it and why, and why does it make a difference between CPython and PyPy. Remember that as we don't have reference counting, weak references can disappear at times that look a bit more "random" in PyPy than in CPython. I can only imagine that it's this kind of abuse of reference counting that hits you with PyPy (or Jython or IronPython fwiw). A bientot, Armin.
Hi Armin: --- On Thu, 11/5/09, Armin Rigo <arigo@tunes.org> wrote:
From: Armin Rigo <arigo@tunes.org>
I am afraid that you will not get much answers, mostly because we are not into developing or supporting the Stackless modules right now.
Fair enough.
However the problem does not seem Stackless-oriented, but just a misuse >of reference counting. You get obviously a weak proxy object, so the question is who made it and why, and why does it make a difference between CPython and PyPy. Remember that as we don't have reference >counting, weak references can disappear at times that look a bit more >"random" in PyPy than in CPython. I can only imagine that it's this kind of abuse of reference counting that hits you with PyPy (or Jython or IronPython fwiw).
Thanks for the response. I removed the weakrefs from stacklesssocket. The echoserver no longer crashes. However my driver still reports errors (about 25% of the connections fail, as opposed to about 60% and a server crash). At this stage, when I have time, I will put more debugging in stacklesssocket.py (or asyncore.py) and my driver to get more information about what is happening. Cheers, Andrew
participants (2)
-
Andrew Francis
-
Armin Rigo