xmlrpclib RPC calls sometimes hang

Gillou nospam at bigfoot.com
Fri Feb 15 06:18:50 EST 2002


Hi,

timeoutsocket acts as a plug in replacement of the blocking parts of the
socket package.
This makes its use (almost) transparent when programming with network
modules (httplib, urllib, ftplib...). You only need to handle Timeout
exceptions in your app.
Theorically, you don't need to change anything in xmlrpclib if the transport
is based on urllib or httplib.
But I dunno for M2Crypto.
Just try it (and feedback to the author), installing and using timeoutsocket
is easy.

import timeoutsocket
import xmlrpclib

timeoutsocket.setDefaultSocketTimeout(20)
s = xmlrpclib.Server('http://www.somewhere.net/foo')
try:
  data = s.getSomething()
except timeoutsocket.Timeout, e:
  # 8((  No response. Keep zen

HTH

--Gilles

"Simrod Furman" <sfurman at nameconnector.com> a écrit dans le message news:
mailman.1013724025.19473.python-list at python.org...
> I'm writing a xmlrpclib client in Python 2.1 using xmlrpclib 0.9.9 on
> Windows NT. I'm having a problem however, since the RPC call through
> xmlrpclib is a blocking call, if there are any problems during the
function
> call such as a dropped modem or a problem on the XML-RPC server, the RPC
> call wedges. As far as I can tell, xmlrpclib just hangs inside the RPC
call.
>
> I'm also using SSL from the M2Crypto library as a plug in the 'transport'
> argument to xmlrpc.Server()
>
> I've heard the suggestion to use timeout sockets from here:
>
> http://aspn.activestate.com/ASPN/Mail/Message/python-announce/935327
>
> as a way to add this functionality in, but I think it would require me to
> modify xmlrpclib.
>
> Question 1: Is there a way to get xmlrpclib to timeout and throw an
> exception after a specified amount of time?
>
> Question 2: Has anyone tried xmlrpclib, SSL, and timeout sockets in Python
> 2.2?
>
> --Simrod
>
> Simrod Furman
> Parlance Corporation, home of the NameConnector Service
> http://www.nameconnector.com
>





More information about the Python-list mailing list