Page MenuHomePhabricator

[avalanche] Move contender cache to peer manager <pre lock fix>
DraftPublic

Authored by roqqit on Wed, Mar 12, 19:38.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

gives inconsistent lock order for 'cs_main' message with no indication that the other lock in question is cs_peerManager

Compare with D17788 to see the fixes necessary to make it work

Test Plan
ninja check-avalanche-processor_tests

Diff Detail

Repository
rABC Bitcoin ABC
Branch
sc-move-cache-to-pm-prelockfix
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32691
Build 64870: Build Diffbuild-diff · lint-circular-dependencies · build-debug · build-clang-tidy · build-clang · build-without-wallet
Build 64869: arc lint + arc unit

Event Timeline

Tail of the build log:

/work /work/abc-ci-builds/lint-circular-dependencies
A new circular dependency in the form of "avalanche/peermanager -> avalanche/stakecontendercache -> avalanche/peermanager" appears to have been introduced.

/work/abc-ci-builds/lint-circular-dependencies
Build lint-circular-dependencies failed with exit code 1

Failed tests logs:

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

------- Stdout: -------
2025-03-12T19:40:24.514000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250312_194021/abc_p2p_avalanche_contender_voting_5
2025-03-12T19:40:26.284000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:20320 due to [Errno 104] Connection reset by peer
2025-03-12T19:40:26.309000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 149, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 139, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 76, in run_test
    quorum = get_quorum()
             ^^^^^^^^^^^^
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 73, in get_quorum
    return [new_ava_interface(node) for _ in range(0, QUORUM_NODE_COUNT)]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 73, in <listcomp>
    return [new_ava_interface(node) for _ in range(0, QUORUM_NODE_COUNT)]
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 60, in new_ava_interface
    peer = get_ava_p2p_interface(self, node, payoutAddress=payoutAddress)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/avatools.py", line 403, in get_ava_p2p_interface
    node.add_p2p_connection(n, services=services)
  File "/work/test/functional/test_framework/test_node.py", line 907, in add_p2p_connection
    p2p_conn.sync_with_ping()
  File "/work/test/functional/test_framework/p2p.py", line 706, in sync_with_ping
    self.wait_until(test_function, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 582, in wait_until
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 280, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/test_framework/p2p.py", line 579, in test_function
    assert self.is_connected
AssertionError
2025-03-12T19:40:26.361000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_avalanche_contender_voting.py", line 471, in <module>
    AvalancheContenderVotingTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 172, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 398, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 653, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 532, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 146, in __call__
    response, status = self._request(
                       ^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 114, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1076, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.11/http/client.py", line 998, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

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