473,756 Members | 6,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xmlrpclib timeouts

Hello,

I'm using the xmlrpclib module to contact an XMLRPC
server that takes a long time to send results back. My
client timeouts.

The question is whether there is a way to have an
xmlrpclib client that never timeouts. I have been
searching for some code examples on how to do that,
but I could not find any in the xmlrpclib
documentation.

Thanks for any hints.

_______________ _______________ ____
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

Jul 18 '05 #1
2 3291
"p2esp" <p2***@yahoo.co m> wrote in message
news:ma******** *************** **************@ python.org...
Hello,

I'm using the xmlrpclib module to contact an XMLRPC
server that takes a long time to send results back. My
client timeouts.

The question is whether there is a way to have an
xmlrpclib client that never timeouts. I have been
searching for some code examples on how to do that,
but I could not find any in the xmlrpclib
documentation.

Thanks for any hints.


"Client that never times out" is not a good idea, generally. Nothing in
life is certain, but even moreso in distributed systems. Timeouts are there
to protect you from all kinds of problem conditions (busy server, crashed
server, etc.). You really don't want your client to be in a position of
waiting for a response that is never going to come.

You are better off turning your synchronous "wait forever" client into an
asynchronous "wait for callback" client. Have your client create a listener
object, and pass a reference to this object as part of your long-running
method call. This allows the XMLRPC call to complete, since it is a brief
submission of work, instead of waiting for the work to complete. When the
server is finished, it uses the callback object to send the results back to
the client.

This does make things more complicated - the server has to save the callback
object so that it knows who to send the results to. The client is probably
going to be multithreaded, so that the client isn't blocked while waiting
for the response (although, given your initial design, this may not bother
you). AND, the server may have to do some exception recovery (or at least
logging), if the client has disconnected before it was able to send back
results.

Another alternative is the "job ticket" model. In this case, the client
calls the server just as you have it coded now, but the return value is some
form of job ticket, or job id. The client then uses this id to periodically
poll the server to see if the results are ready yet. Once the server
replies that results are ready, the client uses the job id as the argument
to a getResults() call on the server. This solution is simpler to code, but
may have implications for network loading (lots of extra polling messages,
as clients repeatedly check if their results are ready), and the server has
to handle the case of clients that disconnect and never pick up their
laundry, um, that is, results.

There are a number of good reference books about client/server programming.
One that I like is "Advanced CORBA Programming with C++" by Henning and
Vinoski. Although it uses CORBA and C++ as its implementation platform, so
you'll have to map the examples to Python and XMLRPC, the concepts are much
the same. And don't be too quick to skip the memory management
discussions - even though Python does its own memory management (in place of
C++'s new/delete model), it is easy to have distributed memory leaks between
client and server. (I have seen a Java memory leak happen this way, even
though Java uses a garbage collection memory management model too.) Another
good resource is Douglas Schmidt's set of web pages at Washington Univ of
St. Louis - see http://www.cs.wustl.edu/~schmidt/patterns.html for some
distributed system patterns papers.

Good luck - distributed systems can be nerve-wracking, but they are also
some of the really cool problems to solve.

-- Paul
Jul 18 '05 #2
p2esp <p2***@yahoo.co m> wrote in message news:<ma******* *************** *************** @python.org>...
Hello,

I'm using the xmlrpclib module to contact an XMLRPC
server that takes a long time to send results back. My
client timeouts.

The question is whether there is a way to have an
xmlrpclib client that never timeouts. I have been
searching for some code examples on how to do that,
but I could not find any in the xmlrpclib
documentation.

Thanks for any hints.


Hmm, I always thought that the XML-RPC client in the xmlrpclib
module was written already to do exactly that. Ie., it will block
until it gets a response. There is no timeout functionality within
it.

Is the server you are talking to within your own network, or are you
going through some sort of HTTP proxy either explicitly or
implicitly, or even some sort of router equipment that does special
things with HTTP requests. HTTP proxies often have timeouts
such that if a request takes too long to get back a response, it
will drop the connection. In other words, the problem may not be
with the XML-RPC client but some part of the intermediate network.

Also, what is the XML-RPC server written in? Could it perhaps be
dropping the connection if the server side code takes too long?
Jul 18 '05 #3

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

Similar topics

0
1766
by: Larry | last post by:
I've had a production system running for a long time that uses xmlrpclib with timeoutsocket, and with my recent upgrade to 2.3 it's no longer able to use xmlrpclib with the xmlrpc servers I communicate with. I can call remote procedures still, but as soon as I import timeoutsocket and the old socket switcharoo is done it's over. To add to the fun I can use xmlrpc w/timeoutsocket if calling functions at the ubiquitous betty.userland.com...
0
757
by: sashan | last post by:
Hi I'm having trouble using xmlrpclib. I register a function (or class) with the SimpleXMLRPCServer and initiate the server. I then create a ServerProxy object and connect to the xml-rpc server. When I call a registerd function or class member function I get the follwoing error. I've attached the server and client source files. File "D:\Python23\lib\xmlrpclib.py", line 742, in close
1
2674
by: Gabriel PASTOR | last post by:
I'm trying to send object using xmlrpclib, but it seems that classes inheriting from object cannot be marshalled. Here is an example: -------- server.py -------- import xmlrpclib, SimpleXMLRPCServer class MyObject(object): def __init__(self,name): self._name=name def getMyObject(name):
0
1121
by: Alan Little | last post by:
I'm trying to write a generic weblog update notifier using xmlrpclib, starting with technorati. What I want to do is something like this : XML config file that would look like this: <server url="http//whatever,technorati.org" methodname="technoratiMethod"> <param sequence="1" source="myAttrib1" /> <param sequence="2" source="myAttrib2" /> </server>
3
2790
by: Rune Froysa | last post by:
Trying something like:: import xmlrpclib svr = xmlrpclib.Server("http://127.0.0.1:8000") svr.test("\x1btest") Failes on the server with:: xml.parsers.expat.ExpatError: not well-formed (invalid token) (Smaller test-case: xmlrpclib.loads(xmlrpclib.dumps(('\x1btest',))))
0
1531
by: Willi Langenberger | last post by:
Hi! We have an application server (Zope) and make heavy use of xml-rpc. One problem arised, when we tried to return a zope.DateTime instance. xmlrpclib (naturally) knows nothing about zope.DateTime and marshalls it as instance, which gives a structure (of zope.DateTime attributes) on the client side (which isnt very usable). It seems we have two possibilities:
5
2080
by: Jonathan Ballet | last post by:
Hello, I have developped a XMLRPC server, which runs under Gnu/Linux with python2.3. This server receives method calls from Windows client. The server got some parameters which are string, which contains carriage return characters, just after the line feed character; like "bla\n\rbla". The problem is, xmlrpclib "eats" those carriage return characters when
2
1530
by: squid | last post by:
First off, I'm a python neophyte, but I'm fairly experienced with Java, C and PHP. I've been trying to use the xmlrpclib to perform remote calls against a service, and it works nicely. However, due to my lack of python-knowledge, I'm rather puzzled at the way the class works. Specifically, suppose I have something like this snippet of code: from xmlrpclib import ServerProxy
0
1655
by: Arno Stienen | last post by:
Perhaps I should be a bit more specific. When using this code to connect to a remote XML-RPC server (C++, xmlrpc++0.7 library): import xmlrpclib server = xmlrpclib.Server("http://10.10.101.62:29500") print server.Connection_Request("roberto") the Python command line 'hangs' until I kill the server. Then, the correct output is suddenly displayed:
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10014
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2647
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.