Page MenuHomePhabricator

[avalanche] initialize avalanche before node.peerman
ClosedPublic

Authored by PiRK on Mon, May 27, 15:48.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC8c9c1fdcba2e: [avalanche] initialize avalanche before node.peerman
Summary

In a next commit, when g_avalanche is removed, the PeerManager::make() factory will need a pointer to m_node.avalanche. Moving the avalanche initialization before the PeerManager initialization in advance makes the following commit slightly easier to review.

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Failed tests logs:

====== Bitcoin ABC functional tests: abc_feature_persist_avapeers.py ======

------- Stdout: -------
2024-05-27T15:56:19.263000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20240527_155431/abc_feature_persist_avapeers_66
2024-05-27T15:56:27.479000Z TestFramework (INFO): Check the node dumps the peer set to a file upon shutdown
2024-05-27T15:56:27.631000Z TestFramework (INFO): Check the loads the dump file upon startup
2024-05-27T15:56:28.135000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 111, in run_test
    self.start_node(
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:56:28.186000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 200, in <module>
    AvalanchePersistAvapeers().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests: abc_rpc_avalancheproof.py ======

------- Stdout: -------
2024-05-27T15:56:02.784000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20240527_155431/abc_rpc_avalancheproof_43
2024-05-27T15:56:03.243000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2024-05-27T15:56:03.247000Z TestFramework (INFO): Test decodeavalancheproof RPC
2024-05-27T15:56:03.653000Z TestFramework (INFO): The proof is registered at first chaintip update if we have inbounds
2024-05-27T15:56:03.760000Z TestFramework (INFO): Start a node with an immature proof
2024-05-27T15:56:05.177000Z TestFramework (INFO): Generate delegations for the proof, verify and decode them
2024-05-27T15:56:05.279000Z TestFramework (INFO): Check the delegation levels are limited
2024-05-27T15:56:05.296000Z TestFramework (INFO): Check the verifyavalancheproof and sendavalancheproof RPCs
2024-05-27T15:56:05.910000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 500, in run_test
    self.restart_node(
  File "/work/test/functional/test_framework/test_framework.py", line 654, in restart_node
    self.start_node(i, extra_args)
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:56:05.961000Z TestFramework (INFO): Stopping nodes
[node 1] Cleaning up leftover process
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 721, in <module>
    AvalancheProofTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_feature_persist_avapeers.py
Bitcoin ABC functional tests: abc_rpc_avalancheproof.py

Failed tests logs:

====== Bitcoin ABC functional tests: abc_feature_persist_avapeers.py ======

------- Stdout: -------
2024-05-27T15:58:58.405000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20240527_155335/abc_feature_persist_avapeers_66
2024-05-27T15:59:09.777000Z TestFramework (INFO): Check the node dumps the peer set to a file upon shutdown
2024-05-27T15:59:10.030000Z TestFramework (INFO): Check the loads the dump file upon startup
2024-05-27T15:59:10.832000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 111, in run_test
    self.start_node(
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:59:10.883000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 200, in <module>
    AvalanchePersistAvapeers().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests: abc_rpc_avalancheproof.py ======

------- Stdout: -------
2024-05-27T15:57:45.906000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20240527_155335/abc_rpc_avalancheproof_43
2024-05-27T15:57:47.341000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2024-05-27T15:57:47.347000Z TestFramework (INFO): Test decodeavalancheproof RPC
2024-05-27T15:57:48.306000Z TestFramework (INFO): The proof is registered at first chaintip update if we have inbounds
2024-05-27T15:57:48.419000Z TestFramework (INFO): Start a node with an immature proof
2024-05-27T15:57:50.351000Z TestFramework (INFO): Generate delegations for the proof, verify and decode them
2024-05-27T15:57:50.478000Z TestFramework (INFO): Check the delegation levels are limited
2024-05-27T15:57:50.502000Z TestFramework (INFO): Check the verifyavalancheproof and sendavalancheproof RPCs
2024-05-27T15:57:50.502000Z TestFramework (INFO): Check a proof with the maximum number of UTXO is valid
2024-05-27T15:58:00.865000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 500, in run_test
    self.restart_node(
  File "/work/test/functional/test_framework/test_framework.py", line 654, in restart_node
    self.start_node(i, extra_args)
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:58:00.917000Z TestFramework (INFO): Stopping nodes
[node 1] Cleaning up leftover process
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 721, in <module>
    AvalancheProofTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_feature_persist_avapeers.py
Bitcoin ABC functional tests: abc_rpc_avalancheproof.py

Failed tests logs:

====== Bitcoin ABC functional tests: abc_feature_persist_avapeers.py ======

------- Stdout: -------
2024-05-27T15:54:26.009000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20240527_155005/abc_feature_persist_avapeers_66
2024-05-27T15:54:35.485000Z TestFramework (INFO): Check the node dumps the peer set to a file upon shutdown
2024-05-27T15:54:35.787000Z TestFramework (INFO): Check the loads the dump file upon startup
2024-05-27T15:54:36.315000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 111, in run_test
    self.start_node(
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:54:36.370000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 200, in <module>
    AvalanchePersistAvapeers().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests: abc_rpc_avalancheproof.py ======

------- Stdout: -------
2024-05-27T15:53:30.200000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20240527_155005/abc_rpc_avalancheproof_43
2024-05-27T15:53:31.637000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2024-05-27T15:53:31.642000Z TestFramework (INFO): Test decodeavalancheproof RPC
2024-05-27T15:53:32.456000Z TestFramework (INFO): The proof is registered at first chaintip update if we have inbounds
2024-05-27T15:53:32.580000Z TestFramework (INFO): Start a node with an immature proof
2024-05-27T15:53:34.302000Z TestFramework (INFO): Generate delegations for the proof, verify and decode them
2024-05-27T15:53:34.418000Z TestFramework (INFO): Check the delegation levels are limited
2024-05-27T15:53:34.433000Z TestFramework (INFO): Check the verifyavalancheproof and sendavalancheproof RPCs
2024-05-27T15:53:34.433000Z TestFramework (INFO): Check a proof with the maximum number of UTXO is valid
2024-05-27T15:53:38.524000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 500, in run_test
    self.restart_node(
  File "/work/test/functional/test_framework/test_framework.py", line 654, in restart_node
    self.start_node(i, extra_args)
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T15:53:38.581000Z TestFramework (INFO): Stopping nodes
[node 1] Cleaning up leftover process
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 721, in <module>
    AvalancheProofTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests with the next upgrade activated: abc_feature_persist_avapeers.py ======

------- Stdout: -------
2024-05-27T16:00:44.990000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20240527_155651/abc_feature_persist_avapeers_66
2024-05-27T16:00:56.237000Z TestFramework (INFO): Check the node dumps the peer set to a file upon shutdown
2024-05-27T16:00:56.539000Z TestFramework (INFO): Check the loads the dump file upon startup
2024-05-27T16:00:57.042000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 111, in run_test
    self.start_node(
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T16:00:57.093000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_feature_persist_avapeers.py", line 200, in <module>
    AvalanchePersistAvapeers().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests with the next upgrade activated: abc_rpc_avalancheproof.py ======

------- Stdout: -------
2024-05-27T15:59:53.081000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20240527_155651/abc_rpc_avalancheproof_43
2024-05-27T15:59:54.735000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2024-05-27T15:59:54.738000Z TestFramework (INFO): Test decodeavalancheproof RPC
2024-05-27T15:59:55.596000Z TestFramework (INFO): The proof is registered at first chaintip update if we have inbounds
2024-05-27T15:59:55.702000Z TestFramework (INFO): Start a node with an immature proof
2024-05-27T15:59:57.392000Z TestFramework (INFO): Generate delegations for the proof, verify and decode them
2024-05-27T15:59:57.511000Z TestFramework (INFO): Check the delegation levels are limited
2024-05-27T15:59:57.526000Z TestFramework (INFO): Check the verifyavalancheproof and sendavalancheproof RPCs
2024-05-27T15:59:57.526000Z TestFramework (INFO): Check a proof with the maximum number of UTXO is valid
2024-05-27T16:00:01.698000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 147, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 137, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 500, in run_test
    self.restart_node(
  File "/work/test/functional/test_framework/test_framework.py", line 654, in restart_node
    self.start_node(i, extra_args)
  File "/work/test/functional/test_framework/test_framework.py", line 612, in start_node
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 348, in wait_for_rpc_connection
    raise FailedToStartError(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status -6 during initialization
2024-05-27T16:00:01.750000Z TestFramework (INFO): Stopping nodes
[node 1] Cleaning up leftover process
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 721, in <module>
    AvalancheProofTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 170, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 396, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 645, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 501, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 278, in __getattr__
    assert self.rpc is not None, self._node_msg("Error: RPC not initialized")
AssertionError: [node 0] Error: RPC not initialized

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_feature_persist_avapeers.py
Bitcoin ABC functional tests: abc_rpc_avalancheproof.py
Bitcoin ABC functional tests with the next upgrade activated: abc_feature_persist_avapeers.py
Bitcoin ABC functional tests with the next upgrade activated: abc_rpc_avalancheproof.py

PiRK retitled this revision from [avalanche] initialize avalanche before LoadChainstate to [avalanche] initialize avalanche before node.peerman.
PiRK edited the summary of this revision. (Show Details)

2 significant changes:

  • initialize Avalanche after LoadChainstate and just before node.peerman
  • Revert to resetting avalanche after peerman. My change didn't make any sense anyway, if the peerman needs a reference to avalanche, we can't destroy the reference before we destroy the user.
PiRK published this revision for review.Wed, May 29, 09:19
PiRK edited the summary of this revision. (Show Details)

@bot build-asan build-tsan

This revision is now accepted and ready to land.Wed, May 29, 18:23