Skip to content

Commit fab908f

Browse files
author
MarcoFalke
committed
test: Fix intermittent ETIMEDOUT on FreeBSD
1 parent aa8d768 commit fab908f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/functional/test_framework/test_node.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ def wait_for_rpc_connection(self):
219219
raise FailedToStartError(self._node_msg(
220220
'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
221221
try:
222-
rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.chain, self.rpchost), self.index, timeout=self.rpc_timeout, coveragedir=self.coverage_dir)
222+
rpc = get_rpc_proxy(
223+
rpc_url(self.datadir, self.index, self.chain, self.rpchost),
224+
self.index,
225+
timeout=self.rpc_timeout // 2, # Shorter timeout to allow for one retry in case of ETIMEDOUT
226+
coveragedir=self.coverage_dir,
227+
)
223228
rpc.getblockcount()
224229
# If the call to getblockcount() succeeds then the RPC connection is up
225230
if self.version_is_at_least(190000):
@@ -260,7 +265,11 @@ def wait_for_rpc_connection(self):
260265
# succeeds. Try again to properly raise the FailedToStartError
261266
pass
262267
except OSError as e:
263-
if e.errno != errno.ECONNREFUSED: # Port not yet open?
268+
if e.errno == errno.ETIMEDOUT:
269+
pass # Treat identical to ConnectionResetError
270+
elif e.errno == errno.ECONNREFUSED:
271+
pass # Port not yet open?
272+
else:
264273
raise # unknown OS error
265274
except ValueError as e: # cookie file not found and no rpcuser or rpcpassword; bitcoind is still starting
266275
if "No RPC credentials" not in str(e):

0 commit comments

Comments
 (0)