Skip to content

Commit 99e5e21

Browse files
committed
Merge #19023: test: Fix intermittent ETIMEDOUT on FreeBSD
fab908f test: Fix intermittent ETIMEDOUT on FreeBSD (MarcoFalke) Pull request description: Example backtrace: https://cirrus-ci.com/task/5307019047469056?command=functional_test#L1059 ACKs for top commit: laanwj: ACK fab908f Tree-SHA512: 06e383e9993e083d6da4c546dde8811ace02559ddbb1c24e307938307763b3abe630699054e7067cf4aea993c82865e259b77b4bee518666a03d26e0f81c0656
2 parents 7418169 + fab908f commit 99e5e21

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)