Used repurposed test script (556b4646985d4313925bf060692e7a690d396629) from #30660 to see how things behave.
Cleaner shutdowns when failing can be achieved by also avoiding stop-attempts here:
0 if self.success == TestStatus.FAILED:
1 self.log.info("Not stopping nodes as test failed")
2 else:
3 self.log.info("Stopping nodes")
4 if self.nodes:
5 self.stop_nodes()
Output without suggestion
0₿ build/test/functional/feature_framework_rpc_failure.py
12025-01-23T10:07:35.733000Z TestFramework (INFO): PRNG seed is: 1128325736874135373
22025-01-23T10:07:35.733000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_qgky8ew8
32025-01-23T10:07:35.744000Z TestFramework (ERROR): Assertion failed
4Traceback (most recent call last):
5 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 131, in main
6 self.setup()
7 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 313, in setup
8 self.setup_network()
9 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 401, in setup_network
10 self.setup_nodes()
11 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 423, in setup_nodes
12 self.start_nodes()
13 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 573, in start_nodes
14 node.wait_for_rpc_connection()
15 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 334, in wait_for_rpc_connection
16 self._raise_assertion_error("Unable to connect to bitcoind after {}s".format(self.rpc_timeout))
17 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 198, in _raise_assertion_error
18 raise AssertionError(self._node_msg(msg))
19AssertionError: [node 0] Unable to connect to bitcoind after 0s
202025-01-23T10:07:35.795000Z TestFramework (INFO): Stopping nodes
21Traceback (most recent call last):
22 File "/home/hodlinator/b2/build/test/functional/feature_framework_rpc_failure.py", line 13, in <module>
23 FeatureFrameworkRPCFailure(__file__).main()
24 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 159, in main
25 exit_code = self.shutdown()
26 ^^^^^^^^^^^^^^^
27 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 328, in shutdown
28 self.stop_nodes()
29 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 587, in stop_nodes
30 node.stop_node(wait=wait, wait_until_stopped=False)
31 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 395, in stop_node
32 self.stop(wait=wait)
33 ^^^^^^^^^
34 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 215, in __getattr__
35 assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
36 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37AssertionError: [node 0] Error: no RPC connection
38[node 0] Cleaning up leftover process
Output with suggestion
0₿ build/test/functional/feature_framework_rpc_failure.py
12025-01-23T10:07:43.326000Z TestFramework (INFO): PRNG seed is: 2921237778351099427
22025-01-23T10:07:43.326000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_7ywaw2wa
32025-01-23T10:07:43.336000Z TestFramework (ERROR): Assertion failed
4Traceback (most recent call last):
5 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 131, in main
6 self.setup()
7 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 313, in setup
8 self.setup_network()
9 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 404, in setup_network
10 self.setup_nodes()
11 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 426, in setup_nodes
12 self.start_nodes()
13 File "/home/hodlinator/b2/test/functional/test_framework/test_framework.py", line 576, in start_nodes
14 node.wait_for_rpc_connection()
15 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 334, in wait_for_rpc_connection
16 self._raise_assertion_error("Unable to connect to bitcoind after {}s".format(self.rpc_timeout))
17 File "/home/hodlinator/b2/test/functional/test_framework/test_node.py", line 198, in _raise_assertion_error
18 raise AssertionError(self._node_msg(msg))
19AssertionError: [node 0] Unable to connect to bitcoind after 0s
202025-01-23T10:07:43.387000Z TestFramework (INFO): Not stopping nodes as test failed
212025-01-23T10:07:43.387000Z TestFramework (WARNING): Not cleaning up dir /tmp/bitcoin_func_test_7ywaw2wa
222025-01-23T10:07:43.387000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/bitcoin_func_test_7ywaw2wa/test_framework.log
232025-01-23T10:07:43.388000Z TestFramework (ERROR):
242025-01-23T10:07:43.388000Z TestFramework (ERROR): Hint: Call /home/hodlinator/b2/test/functional/combine_logs.py '/tmp/bitcoin_func_test_7ywaw2wa' to consolidate all logs
252025-01-23T10:07:43.388000Z TestFramework (ERROR):
262025-01-23T10:07:43.388000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
272025-01-23T10:07:43.388000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
282025-01-23T10:07:43.388000Z TestFramework (ERROR):
29[node 0] Cleaning up leftover process
Similar results can be observed by using wallet_migration.py as described in #31620 (comment).