471,624 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

python xmlrpc: cannot handle connection errors

Hello everyone!

I am trying to set up a broker-worker system (one broker, multiple and
heterogeneous workers) in python for a local network (though possibly
also over inet). I am using SimpleXMLRPCServer and
xmlrpclib.ServerProxy for connections.

Whatever I do, after about 100,000 to 150,000 XMLRPCalls over a single
ServerProxy connection, I am getting a connection error (usually
"connection reset by peer"). I have tried deleting the ServerProxy,
setting up a new one and calling the function again when the error
occurs, but this does not change anything:

# this is the worker's secureRPC; the broker's works analogously
def worker_secureRPC(self, fname, args=None):
tries = 2 # raising the nr of tries does not change
retval = None
for i in range(0,tries):
fref = self.getfref(fname)
# returns a reference to
if (args==None):
retval = fref()
retval = fref(*args)
self.sender = None
self.sender = ServerProxy("http://" + self.brokerHost + ":" +
if (i>=(tries-1)):
Then, thinking that maybe the "return" statement produces the error, I
tried doing error handling there as well (keep in mind that the
function might have been called already, so don't do the same action

def worker_foo(self, popcontainer, failed=[]):
if (len(failed) 0):
while (len(failed) 0):
return True

The function foo gets called remotely after the set-up of the new
ServerProxy, but does produce the same error again! (socket.error:
connection reset by peer). Btw, another function sends the result back
to the Broker again via xmlrpc, resulting in asynchronous
communication, so we only need to return some bogus value here.

Am I missing sth obvious here, or why can I not re-build the
connection? What can I do to handle this error correctly?



Jul 24 '06 #1
0 1144

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Michael Urman | last post: by
5 posts views Thread by writeson | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
reply views Thread by Benjamin Grieshaber | last post: by
10 posts views Thread by bruce | last post: by
35 posts views Thread by eliben | last post: by
4 posts views Thread by care02 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.