Stopping nodes
Traceback (most recent call last):
File "/home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/wallet.py", line 254, in <module>
WalletTest ().main ()
File "/home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/test_framework/test_framework.py", line 134, in main
stop_nodes(self.nodes)
File "/home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/test_framework/util.py", line 218, in stop_nodes
node.stop()
File "/home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/test_framework/authproxy.py", line 138, in __call__
response = self._request('POST', self.__url.path, postdata)
File "/home/travis/build/bitcoin/bitcoin/bitcoin-i686-pc-linux-gnu/qa/rpc-tests/test_framework/authproxy.py", line 124, in _request
self.__conn.request(method, path, postdata, headers)
File "/usr/lib/python2.7/httplib.py", line 958, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 776, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 757, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 111] Connection refused
I think the problem is a race condition:
stopcommand is sent to RPC by client- Node queues
Bitcoin server stoppingreply (see https://github.com/bitcoin/bitcoin/blob/master/src/rpcserver.cpp#L246) - Node shuts down
- Reply never arrives at client
- Client re-tries
stopbecause it assumes the connection was slammed due to a timeout (see #6695) - Client encounters closed port, and throws 'connection refused' error
The "Shutdown will take long enough that the response should get back" comment may no longer ring true with the new http server.
To solve this we'll have to make sure that the reply is always sent before the shutdown sequence is initiated.
Edit: can reproduce this reliably by putting a sleep(3) between the StartShutdown and return.