Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#28253: test: display abrupt shutdown errors in …
Browse files Browse the repository at this point in the history
…console output

0f83ab4 test: display abrupt shutdown errors in console output (furszy)

Pull request description:

  Making it easier to debug errors in the CI environment,
  particularly in scenarios where it's not immediately clear
  what happened nor which node crashed (or shutdown abruptly).

  A bit of context:
  Currently, the test framework redirects each node's stderr output
  stream to a different temporary file inside each node's data directory.
  While this is sufficient for storing the error, it isn't very helpful for
  understanding what happened just by reading the CI console output.

  Most of the time, reading the stderr file in the CI environment is not
  possible, because people don't have access to it.

  Testing Note:
  The displayed error difference can be observed by cherry-picking this
  commit furszy/bitcoin-core@9cc5393 on top of this branch and running any
  functional test.

ACKs for top commit:
  maflcko:
    lgtm ACK 0f83ab4
  theStack:
    ACK 0f83ab4

Tree-SHA512: 83ce4d21d5316e8cb16a17d3fbe77b8649fced9e09410861d9674c233f6e9c34bcf573504e387e4f439c2841b2ee9855d0d35607fa13aa89eafe0080c45ee82d
  • Loading branch information
fanquake committed Oct 6, 2023
2 parents 634b68f + 0f83ab4 commit 1472df6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,13 @@ def wait_for_rpc_connection(self):
poll_per_s = 4
for _ in range(poll_per_s * self.rpc_timeout):
if self.process.poll() is not None:
# Attach abrupt shutdown error/s to the exception message
self.stderr.seek(0)
str_error = ''.join(line.decode('utf-8') for line in self.stderr)
str_error += "************************\n" if str_error else ''

raise FailedToStartError(self._node_msg(
'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
f'bitcoind exited with status {self.process.returncode} during initialization. {str_error}'))
try:
rpc = get_rpc_proxy(
rpc_url(self.datadir, self.index, self.chain, self.rpchost),
Expand Down

0 comments on commit 1472df6

Please sign in to comment.