This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author demian.brecht
Recipients Yuri.Bochkarev, agriffis, alanjds, amak, cananian, demian.brecht, icordasc, jcea, jhylton, martin.panter, mhammond, orsenthil, r.david.murray, rbcollins
Date 2015-02-11.14:19:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
> Thanks for helping with this Demian. 
No worries. This textual white boarding exercise has also been greatly
valuable in getting my own head wrapped around various low frequency
socket level errors that can be encountered when using the client. The
downside is that this issue is now quite likely very difficult for new
readers to follow :/

> The idea of raising the same exception in all cases is new to me.
This initially puzzled me. I then re-read my response and realized that
I was thinking one thing and wrote another. The exception that I was
intending to suggest using here is ConnectionResetError, rather than the
ConnectionError base class. To elaborate a little further, as I
understand it, the /only/ case where the empty read happens is when the
remote connection has been closed but where the TCP still allows for EOS
to be read. In this case, the higher level implementation (in this case
the client) /knows/ that the empty line is signifying that the
connection has been closed by the remote host.

To be clear, a rough example of what I'm proposing is this:

diff -r e548ab4ce71d Lib/http/
--- a/Lib/http/        Mon Feb 09 19:49:00 2015 +0000
+++ b/Lib/http/        Wed Feb 11 06:04:08 2015 -0800
@@ -210,7 +210,7 @@
         if not line:
             # Presumably, the server closed the connection before
             # sending a valid response.
-            raise BadStatusLine(line)
+            raise ConnectionResetError
             version, status, reason = line.split(None, 2)
         except ValueError:

Your example of the XML-RPC client would then use the alternative approach:

    return self.single_request(...)
except ConnectionError:
    #retry request once if cached connection has gone cold
    return self.single_request(...)

That all said, I'm also not tremendously opposed to the introduction of
the ConnectionClosed exception. I simply wanted to explore this thought
before the addition is made, although the comments in my patch review
would still hold true.
Date User Action Args
2015-02-11 14:19:32demian.brechtsetrecipients: + demian.brecht, jhylton, mhammond, jcea, orsenthil, amak, rbcollins, cananian, r.david.murray, alanjds, agriffis, martin.panter, icordasc, Yuri.Bochkarev
2015-02-11 14:19:32demian.brechtlinkissue3566 messages
2015-02-11 14:19:32demian.brechtcreate