[Stackless] Listening to a socket with stacklesslib

Richard Tew richard.m.tew at gmail.com
Mon Jul 23 04:23:38 CEST 2012


On Mon, Jul 23, 2012 at 1:55 PM, Jeff Harper <jeff1.61803 at gmail.com> wrote:
> I'm a new subscriber to this list although I have looked through the mail
> archives many times over the last few months to find answers to my
> questions.

Excellent :-)  It feels rude to paste links to old answers to old
questions, so this is always good.

> I recently discovered stacklesslib and learned that it has a replacement for
> sockets that works well with stackless.  I've tried modifying my server to
> use sockets from stacklesslib.  Unfortunately, my server goes into the
> socket.accept method but it never returns. The documentation for
> stacklesslib is pretty sparse.  I've looked for tutorials on the web and I
> haven't found anything.  So, I have no idea what I'm doing wrong

The latest version is 1.0.4 or some modified form thereof and is
available from here:

  http://code.google.com/p/stacklessexamples/source/browse/trunk/libraries/stacklesslib/

But I am not sure if that has the same problem.  What I think the
problem is, is that the replacement socket module is not getting
pumped.  This means that no events are being noticed, like the
accepting of an incoming connection, and  therefore all blocked
tasklets block indefinitely.

Go into monkeypatch.py and change will_be_pumped argument passed into
patch_socket, to default to False.  Looking at 1.0.4, this is the way
it works.  And in fact, 1.0.4 does it in a much cleaner manner.

Sorry for the strange design decision / bug! :-)

Cheers,
Richard.



More information about the Stackless mailing list