Skip to content

Commit fae66fc

Browse files
author
MarcoFalke
committed
test: Remove python3.5 workaround in authproxy
Also, move the burden of checking for a timeout to the client and disable the timeout on the server. This should avoid intermittent issues in slow tests (for example mining_getblocktemplate_longpoll.py, or feature_dbcrash.py), or possibly when the server is running slow (for example in valgrind). There shouldn't be any downside in tests caused by a high rpcservertimeout.
1 parent 5c2bb2b commit fae66fc

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

test/functional/feature_dbcrash.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ def set_test_params(self):
5151
self.supports_cli = False
5252

5353
# Set -maxmempool=0 to turn off mempool memory sharing with dbcache
54-
# Set -rpcservertimeout=900 to reduce socket disconnects in this
55-
# long-running test
56-
self.base_args = ["-limitdescendantsize=0", "-maxmempool=0", "-rpcservertimeout=900", "-dbbatchsize=200000"]
54+
self.base_args = [
55+
"-limitdescendantsize=0",
56+
"-maxmempool=0",
57+
"-dbbatchsize=200000",
58+
]
5759

5860
# Set different crash ratios and cache sizes. Note that not all of
5961
# -dbcache goes to the in-memory coins cache.

test/functional/test_framework/authproxy.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def __getattr__(self, name):
9494

9595
def _request(self, method, path, postdata):
9696
'''
97-
Do a HTTP request, with retry if we get disconnected (e.g. due to a timeout).
98-
This is a workaround for https://bugs.python.org/issue3566 which is fixed in Python 3.5.
97+
Do a HTTP request.
9998
'''
10099
headers = {'Host': self.__url.hostname,
101100
'User-Agent': USER_AGENT,
@@ -106,24 +105,8 @@ def _request(self, method, path, postdata):
106105
# TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows
107106
# Avoid "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine"
108107
self._set_conn()
109-
try:
110-
self.__conn.request(method, path, postdata, headers)
111-
return self._get_response()
112-
except (BrokenPipeError, ConnectionResetError):
113-
# Python 3.5+ raises BrokenPipeError when the connection was reset
114-
# ConnectionResetError happens on FreeBSD
115-
self.__conn.close()
116-
self.__conn.request(method, path, postdata, headers)
117-
return self._get_response()
118-
except OSError as e:
119-
# Workaround for a bug on macOS. See https://bugs.python.org/issue33450
120-
retry = '[Errno 41] Protocol wrong type for socket' in str(e)
121-
if retry:
122-
self.__conn.close()
123-
self.__conn.request(method, path, postdata, headers)
124-
return self._get_response()
125-
else:
126-
raise
108+
self.__conn.request(method, path, postdata, headers)
109+
return self._get_response()
127110

128111
def get_request(self, *args, **argsn):
129112
AuthServiceProxy.__id_count += 1

test/functional/test_framework/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
390390
f.write("[{}]\n".format(chain_name_conf_section))
391391
f.write("port=" + str(p2p_port(n)) + "\n")
392392
f.write("rpcport=" + str(rpc_port(n)) + "\n")
393+
# Disable server-side timeouts to avoid intermittent issues
394+
f.write("rpcservertimeout=99000\n")
393395
f.write("rpcdoccheck=1\n")
394396
f.write("fallbackfee=0.0002\n")
395397
f.write("server=1\n")

0 commit comments

Comments
 (0)