Rev 6510: I think this is a fix for bug #1047325. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-conn-reset-socket-pipe-1047325

John Arbash Meinel john at arbash-meinel.com
Fri Sep 7 12:38:48 UTC 2012


At http://bazaar.launchpad.net/~jameinel/bzr/2.5-conn-reset-socket-pipe-1047325

------------------------------------------------------------
revno: 6510
revision-id: john at arbash-meinel.com-20120907123818-tq2qsh7gum6aixjx
parent: pqm at pqm.ubuntu.com-20120907110410-fqh06iqg61pknazl
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-conn-reset-socket-pipe-1047325
timestamp: Fri 2012-09-07 16:38:18 +0400
message:
  I think this is a fix for bug #1047325.
  
  We just weren't actually detecting that a connection was closed in the socket medium.
  Not sure how that was missed.
  
  Have to figure out how to write up tests for this.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2011-12-24 09:59:02 +0000
+++ b/bzrlib/smart/medium.py	2012-09-07 12:38:18 +0000
@@ -1055,7 +1055,13 @@
     def _accept_bytes(self, bytes):
         """See SmartClientMedium.accept_bytes."""
         self._ensure_connection()
-        osutils.send_all(self._socket, bytes, self._report_activity)
+        try:
+            osutils.send_all(self._socket, bytes, self._report_activity)
+        except (OSError, IOError, socket.error), e:
+            if e.errno in (errno.EINVAL, errno.EPIPE, errno.ECONNRESET):
+                raise errors.ConnectionReset(
+                    "Error trying to write to socket:\n%s" % (e,))
+            raise
 
     def _ensure_connection(self):
         """Connect this medium if not already connected."""



More information about the bazaar-commits mailing list