[Stackless] weakref problem with stacklesssocket.py

Richard Tew richard.m.tew at gmail.com
Thu Oct 16 13:39:21 CEST 2008

On Wed, Oct 15, 2008 at 11:27 PM, Jon Rosebaugh <chairos at gmail.com> wrote:
> I am not sure how best to go about debugging this problem, but I will
> note that it seems to go away when I comment out the add_channel
> method defined in lines 183-186.
>  File "testing/runit.py", line 8, in <module>
>    main()
>  File "testing/runit.py", line 4, in main
>    stdin_listener("flickr", "twitter", "facebook", "yahoo", "gmail",
> "hotmail", "feed")
>  File "/Users/jon/pytest/chimpbots/chimpbots/listener.py", line 20,
> in stdin_listener
>    stackless.run()
>  File "/Users/jon/pytest/chimpbots/chimpbots/libs/stacklesssocket.py",
> line 77, in ManageSockets
>    asyncore.poll(0.05)
>  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py",
> line 109, in poll
>    is_r = obj.readable()
> ReferenceError: weakly-referenced object no longer exists
> I don't really understand the workings of asyncore and the socket
> module, so I'm reluctant to start poking a lot at it without guidance.

You really need to strip down your code and make a reproduction case.
There is too much uncertainty for it to be worth my time to do
anything other than speculate without one.  Here is some speculation:
you are not holding onto references to your sockets.

> I have read in previous postings on the list that stacklesssocket.py
> is meant really as example code. However, given that the regular

That's because I don't have the time to make it anything more than a
decent approximation at a socket module emulation.  I do not have the
time to maintain and polish it.

> socket module blocks all tasklets, I think stackless ought to ship
> _some_ working replacement.

In an ideal world, yes.  But in this one, it requires people to write
and maintain those replacements.  And besides that, an
all-encompassing solution for what some faction thinks are good IO
resource replacement solutions, is outside the scope of Stackless IMO.

A better idea would be for the people who write those replacements to
build a package, which I can distribute with Stackless builds.  And
others who build Stackless on their own, to acquire for themselves.

But then these replacements don't really exist.. so, no point in
thinking too much about it at this point.


More information about the Stackless mailing list