Looks like it fixes #8045.
I cannot explain the failure (it happens 100% reproducibly for me, with a clean cache and no other bitcoind running, even when running outside of rpc-tests.py):
0$ ./walletbackup.py
1INFO: Initializing test directory /tmp/testnfwna8uq
2INFO: Generating initial blockchain
3INFO: Creating transactions
4INFO: Backing up
5INFO: More transactions
6INFO: Restoring using wallet.dat
7INFO: Re-starting nodes
8INFO: Restoring using dumped wallet
9Unexpected exception caught during testing: BrokenPipeError(32, 'Broken pipe')
10 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/test_framework.py", line 138, in main
11 self.run_test()
12 File "./walletbackup.py", line 193, in run_test
13 sync_blocks(self.nodes)
14 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/util.py", line 127, in sync_blocks
15 counts = [ x.getblockcount() for x in rpc_connections ]
16 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/util.py", line 127, in <listcomp>
17 counts = [ x.getblockcount() for x in rpc_connections ]
18 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/coverage.py", line 49, in __call__
19 return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
20 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 137, in __call__
21 response = self._request('POST', self.__url.path, postdata)
22 File "/home/pw/git/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 118, in _request
23 self.__conn.request(method, path, postdata, headers)
24 File "/usr/lib/python3.5/http/client.py", line 1106, in request
25 self._send_request(method, url, body, headers)
26 File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
27 self.endheaders(body)
28 File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
29 self._send_output(message_body)
30 File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
31 self.send(message_body)
32 File "/usr/lib/python3.5/http/client.py", line 908, in send
33 self.sock.sendall(data)
34Stopping nodes
35WARN: Unable to stop node: CannotSendRequest('Request-sent',)
I also can’t explain why Travis doesn’t have this problem. I certainly can’t explain why this patch fixes it or even remotely has anything to do with the observed problem, but it fixes it 100% reproducibly.