Merge lp://staging/~mbp/bzr/2.5-client-reconnect-819604 into lp://staging/bzr
Proposed by
Martin Pool
Status: | Merged |
---|---|
Merged at revision: | 6321 |
Proposed branch: | lp://staging/~mbp/bzr/2.5-client-reconnect-819604 |
Merge into: | lp://staging/bzr |
Diff against target: |
1557 lines (+917/-239) (has conflicts) 15 files modified
bzrlib/help_topics/en/debug-flags.txt (+2/-0) bzrlib/smart/client.py (+208/-86) bzrlib/smart/medium.py (+20/-5) bzrlib/smart/protocol.py (+5/-3) bzrlib/smart/request.py (+179/-105) bzrlib/tests/servers.py (+75/-0) bzrlib/tests/test_bundle.py (+7/-35) bzrlib/tests/test_smart.py (+5/-2) bzrlib/tests/test_smart_request.py (+10/-0) bzrlib/tests/test_smart_transport.py (+376/-0) doc/en/release-notes/bzr-2.1.txt (+5/-0) doc/en/release-notes/bzr-2.2.txt (+5/-0) doc/en/release-notes/bzr-2.3.txt (+5/-0) doc/en/release-notes/bzr-2.4.txt (+7/-3) doc/en/release-notes/bzr-2.5.txt (+8/-0) Text conflict in bzrlib/smart/request.py Text conflict in doc/en/release-notes/bzr-2.5.txt |
To merge this branch: | bzr merge lp://staging/~mbp/bzr/2.5-client-reconnect-819604 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | Approve | ||
Review via email: mp+83555@code.staging.launchpad.net |
Commit message
Bug #819604, allow clients to reconnect if they get ConnectionReset while trying to send an RPC.
Description of the change
Continues on from https:/
improving the DisconnectingTC
A few changes:
* closing a socket will not interrupt a server that's accepting connections on that socket
* with John's changes, the client does not connect exactly once
To post a comment you must log in.
Focusing on ./bzr selftest -s bzrlib. tests.test_ bundle. TestReadMergeab leFromUrl. test_smart_ server_ connection_ reset.
Running this command repeatedly shows that either the test succeeds in ~50ms OR ~10.000ms. I.e. the select timeout triggers.
With this patch:
modified bzrlib/ tests/servers. py
=== modified file 'bzrlib/ tests/servers. py' tests/servers. py 2011-11-28 07:52:49 +0000 tests/servers. py 2011-11-28 09:33:09 +0000
self. sock.setblockin g(False)
conn, addr = self.sock.accept() socket( socket. AF_INET, socket.SOCK_STREAM)
conn. connect( self.sock. getsockname( )) socket. SHUT_RDWR)
conn. close()
--- bzrlib/
+++ bzrlib/
@@ -40,10 +40,6 @@
while not self._please_stop:
try:
- # We can't just accept here, because accept is not interrupted
- # by the listen socket being asynchronously closed by
- # stop_server. However, select will be interrupted.
- select.select([fd], [fd], [fd], 10)
except (select.error, socket.error), e:
en = getattr(e, 'errno') or e[0]
@@ -68,6 +64,7 @@
# just in case the test failed to do so.
conn = socket.
+ conn.shutdown(
except socket.error:
pass
Running the same command 1.000 times reliably succeeds in ~50ms.
I don't think the select is worth it, what matters is to shutdown() the socket instead of just close()'ing it.