Rev 6514: Merge 2.5 including the other osutils.send_all fix. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-conn-reset-socket-pipe-1047325
John Arbash Meinel
john at arbash-meinel.com
Tue Sep 11 08:39:28 UTC 2012
At http://bazaar.launchpad.net/~jameinel/bzr/2.5-conn-reset-socket-pipe-1047325
------------------------------------------------------------
revno: 6514 [merge]
revision-id: john at arbash-meinel.com-20120911083914-j35o15f848xkl34n
parent: john at arbash-meinel.com-20120910115639-lno6q910yrakt0rf
parent: pqm at pqm.ubuntu.com-20120911075707-gyi8ss0rkgprg3h2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-conn-reset-socket-pipe-1047325
timestamp: Tue 2012-09-11 12:39:14 +0400
message:
Merge 2.5 including the other osutils.send_all fix.
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2012-09-10 11:50:34 +0000
+++ b/bzrlib/osutils.py 2012-09-11 08:39:14 +0000
@@ -2143,8 +2143,12 @@
if e.args[0] != errno.EINTR:
raise
else:
+ if sent == 0:
+ raise errors.ConnectionReset('Sending to %s returned 0 bytes'
+ % (sock,))
sent_total += sent
- report_activity(sent, 'write')
+ if report_activity is not None:
+ report_activity(sent, 'write')
def connect_socket(address):
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py 2012-09-10 11:56:39 +0000
+++ b/bzrlib/tests/test_osutils.py 2012-09-11 08:39:14 +0000
@@ -839,6 +839,25 @@
self.assertRaises(errors.ConnectionReset,
osutils.send_all, sock, 'some more content')
+ def test_send_with_no_progress(self):
+ # See https://bugs.launchpad.net/bzr/+bug/1047309
+ # It seems that paramiko can get into a state where it doesn't error,
+ # but it returns 0 bytes sent for requests over and over again.
+ class NoSendingSocket(object):
+ def __init__(self):
+ self.call_count = 0
+ def send(self, bytes):
+ self.call_count += 1
+ if self.call_count > 100:
+ # Prevent the test suite from hanging
+ raise RuntimeError('too many calls')
+ return 0
+ sock = NoSendingSocket()
+ self.assertRaises(errors.ConnectionReset,
+ osutils.send_all, sock, 'content')
+ self.assertEqual(1, sock.call_count)
+
+
class TestPosixFuncs(tests.TestCase):
"""Test that the posix version of normpath returns an appropriate path
when used with 2 leading slashes."""
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2012-09-06 12:05:27 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2012-09-07 13:15:02 +0000
@@ -39,6 +39,13 @@
extracted texts from the repository. (Just an ordering constraint on how
they consumed the stream.) (John Arbash Meinel, #1046284)
+* ``osutils.send_all`` now detects if we get a series of zero bytes sent,
+ and fails with a ECONNRESET. It seems if paramiko gets disconnected, it
+ will get into a state where it returns 0 bytes sent, but doesn't raise
+ an error. This change allows us to get a couple hiccups of no content
+ sent, but if it is consistent, we will consider it to be a failure.
+ (John Arbash Meinel, #1047309)
+
* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)
* Some small bug fixes wrt lightweight checkouts and remote repositories.
More information about the bazaar-commits
mailing list