]> granicus.if.org Git - python/commitdiff
#9032: XML-RPC client: Transport.request() retries on EPIPE error
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 24 Jul 2010 02:24:55 +0000 (02:24 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 24 Jul 2010 02:24:55 +0000 (02:24 +0000)
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.

Lib/http/client.py
Lib/xmlrpc/client.py
Misc/NEWS

index c83c53b60b072e751723b905106955514fedb6ec..e4a9c079d9326f678b47afaa0bd23fc1281e7143 100644 (file)
@@ -734,11 +734,6 @@ class HTTPConnection:
             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
index a72908cb978694381d75f68b9050148b08d8d994..d9c43c24b4137532c24d87e838b1a05643ca9926 100644 (file)
@@ -1135,7 +1135,7 @@ class Transport:
             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:
index 295a9a7e732645f55ffd32f9fd16770f7b8fa6f0..ee46e94d7a96a5051a42c08ed86fa2657a09997d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -473,6 +473,10 @@ C-API
 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).