[Python-checkins] r83120 - in python/branches/py3k: Lib/http/client.py Lib/xmlrpc/client.py Misc/NEWS

victor.stinner python-checkins at python.org
Sat Jul 24 04:24:56 CEST 2010


Author: victor.stinner
Date: Sat Jul 24 04:24:55 2010
New Revision: 83120

Log:
#9032: XML-RPC client: Transport.request() retries on EPIPE error

The EPIPE error occurs when the server closes the socket and the client sends a
"big" XML-RPC request (I don't know exactly the size threshold).

request() just have to ignore the error because single_request() closes the
socket on error, and so the next call to single_request() will open a new
socket.

Remove also a comment in the HTTP client because it's now wrong: see r70643
and issue #5542.


Modified:
   python/branches/py3k/Lib/http/client.py
   python/branches/py3k/Lib/xmlrpc/client.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/http/client.py
==============================================================================
--- python/branches/py3k/Lib/http/client.py	(original)
+++ python/branches/py3k/Lib/http/client.py	Sat Jul 24 04:24:55 2010
@@ -734,11 +734,6 @@
             else:
                 raise NotConnected()
 
-        # send the data to the server. if we get a broken pipe, then close
-        # the socket. we want to reconnect when somebody tries to send again.
-        #
-        # NOTE: we DO propagate the error, though, because we cannot simply
-        #       ignore the error... the caller will know if they can retry.
         if self.debuglevel > 0:
             print("send:", repr(str))
         blocksize = 8192

Modified: python/branches/py3k/Lib/xmlrpc/client.py
==============================================================================
--- python/branches/py3k/Lib/xmlrpc/client.py	(original)
+++ python/branches/py3k/Lib/xmlrpc/client.py	Sat Jul 24 04:24:55 2010
@@ -1135,7 +1135,7 @@
             try:
                 return self.single_request(host, handler, request_body, verbose)
             except socket.error as e:
-                if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED):
+                if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
                     raise
             except http.client.BadStatusLine: #close after we sent request
                 if i:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Jul 24 04:24:55 2010
@@ -473,6 +473,10 @@
 Library
 -------
 
+- Issue #9032: XML-RPC client retries the request on EPIPE error. The EPIPE
+  error occurs when the server closes the socket and the client sends a big
+  XML-RPC request.
+
 - Issue #4629: getopt raises an error if an argument ends with = whereas getopt
   doesn't except a value (eg. --help= is rejected if getopt uses ['help='] long
   options).


More information about the Python-checkins mailing list