473,378 Members | 1,321 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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
anything
retval = None
for i in range(0,tries):
try:
fref = self.getfref(fname)
# returns a reference to
self.sender.fname
if (args==None):
retval = fref()
else:
retval = fref(*args)
except:
self.sender = None
time.sleep(1)
self.sender = ServerProxy("http://" + self.brokerHost + ":" +
str(self.brokerPort))
if (i>=(tries-1)):
raise
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
twice):

def worker_foo(self, popcontainer, failed=[]):
self.lock.acquire()
if (len(failed) 0):
while (len(failed) 0):
failed.pop()
else:
do_stuff_in_new_thread()
self.lock.release()
try:
return True
except:
failed.append("failed")

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?

cheers,

Christoph

Jul 24 '06 #1
0 1213

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Michael Urman | last post by:
Hi. I'm a user of python for about 3 years now. I've written a client-server application that uses SimpleXMLRPCServer and xmlrpclib.ServerProxy to communicate. It's intended to be used by a...
5
by: writeson | last post by:
Hi all, I helped one of my co-workers put together an XMLRPC Python script that allowed him to get database data from remote machines. This was done because the source of the data could be...
3
by: evelyne0510 | last post by:
Hi all, I have created a XML-RPC model (with server and client) written in Java. I want to call the methods in another XML-RPC model written in Python. I know that in Java, I can use like...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open...
0
by: Benjamin Grieshaber | last post by:
Hi, I´m on SuSE 9.3 with xmlrpc-c and xmlrpc-c-devel installed (ver. 0.9.10) I tried to compile php with xmlrpc support and got the following errors: ...
10
by: bruce | last post by:
hi... can someone point me to where/how i would go about calling a ruby app from a python app, and having the python app being able to get a returned value from the ruby script. something...
35
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly,...
4
by: care02 | last post by:
I have implemented a simple Python XMLRPC server and need to call it from a C/C++ client. What is the simplest way to do this? I need to pass numerical arrays from C/C++ to Python. Yours, Carl
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.