Problem with S-XML-RPC

Discussion of Common Lisp
Post Reply
kghost
Posts: 1
Joined: Thu Aug 25, 2011 1:42 am

Problem with S-XML-RPC

Post by kghost » Thu Aug 25, 2011 1:55 am

Hi,

I am writing some lisp code and provide APIs via XML-RPC. The XML-RPC server is created by S-XML-RPC package.
However, there are multiple requests coming for XML-RPC server and it seems that multiple requests can't be handled at the same time. Could anyone explain it and share the proper solution?

pjstirling
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Re: Problem with S-XML-RPC

Post by pjstirling » Fri Aug 26, 2011 3:05 pm

Saying which lisp you are using would be helpful.

Looking at the implementation of (START-STANDARD-SERVER ...) in sysdeps.lisp for sbcl it appears to use select() (look in `man 2 select` for details of this in general) multiplexing so it isn't multi-threaded. select() based networking is intended for I/O bound processes.

If your rpc call needs to last a while then either you should fork a thread and return (in which case your client will need to call back for get the result later), or you need to get your hands dirty and write a multi-threaded accept loop and avoid (START-XML-RPC-SERVER ...). Or you could have the client start its own server and have the server make a connection once it completes to return the result, but this won't work behind NAT networks/firewalls

Post Reply