[Stackless] Problem with xmlrpc over stacklesssocket

Richard Tew richard.m.tew at gmail.com
Thu Sep 23 06:20:50 CEST 2010


On Tue, Sep 14, 2010 at 5:53 PM, Ray Gallagher <omyar_hunt at yahoo.co.uk> wrote:
> Was wondering if you could point me in the right direction. Not sure if stacklesssocket is your project exactly though.
>
> I'm having trouble with the basic python xmlrpc client over stacklesssocket. Basically, whenever I try to connect, the tasklet hangs. Other network protocols (basic http and memcache connections) seem to work fine. Also, the SimpleXMLRPCServer works fine under stacklesssocket. Seems to only be the xmlrpc client.
>
> Anyone know how to tweak stacklesssocket to work with xmlrpc? I've attached runnable example code.

Hi Ray,

Your code appears to work fine for me.  I am using an updated version
of stackless socket, but the changes are superficial and only affect
UDP related usage.

The client consistently prints the following:

  C:\Users\richardt\Stackless>sl27\PCbuild\python_d.exe client.py
  Attempting to connect
  pong
  Connected to google

Note that your server code should be cause for alarm, just by reading it:

def run_server():
    ...
    server = SimpleXMLRPCServer(("localhost", 8888), allow_none=True)
    server.register_function(ping, "ping")
    server.serve_forever()

The call in a tasklet to "serve_forever" implies you are invoking a
framework.  And indeed, looking at the implementation shows that this
has an effect on any other tasklets:

    def serve_forever(self, poll_interval=0.5):
            ...
            while not self.__shutdown_request:
                ...
                r, w, e = select.select([self], [], [], poll_interval)
                ...

Nothing within this yields to the scheduler.  And additionally, it
will block for half a second waiting for socket activity.  If you use
this without making it scheduler friendly, then you might as well not
use any Stackless functionality on the server side.

But back to the point, your code runs fine for me.

Cheers,
Richard.



More information about the Stackless mailing list