Page MenuHomePhabricator

test: Remove workarounds in authproxy
ClosedPublic

Authored by PiRK on Fri, Dec 6, 12:04.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC6b3987abc00a: test: Remove workarounds in authproxy
Summary

The WinError 10053 can be solved with a larger dynamic port range, if we ever run CI tests on Windows: see core#23089

The python 3.5 workaround is no longer needed since we support python >=3.9.

The other windows workaround is probably no longer necessary after bumping the server timeout for all tests (util.py:write_config change)

Also, move the burden of checking for a timeout to the client and
disable the timeout on the server. This should avoid intermittent issues
in slow tests (for example mining_getblocktemplate_longpoll.py, or
feature_dbcrash.py), or possibly when the server is running slow (for
example in valgrind). There shouldn't be any downside in tests caused
by a high rpcservertimeout.

This is a backport of core#23092, core#27378 and core#27418

Test Plan

ninja check-functional-extended

Diff Detail

Event Timeline

PiRK requested review of this revision.Fri, Dec 6, 12:04
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

Failed tests logs:

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

------- Stdout: -------
2024-12-06T12:25:21.166000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20241206_122519/feature_abortnode_5
2024-12-06T12:25:21.860000Z TestFramework (INFO): Waiting for crash
2024-12-06T12:28:41.895000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
'''
2024-12-06T12:28:41.895000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 148, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 138, in _run_test_internal
    self.run_test()
  File "/work/test/functional/feature_abortnode.py", line 45, in run_test
    self.nodes[0].wait_until_stopped(timeout=200)
  File "/work/test/functional/test_framework/test_node.py", line 557, in wait_until_stopped
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 300, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
''' not true after 200.0 seconds
2024-12-06T12:28:41.946000Z 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/feature_abortnode.py", line 51, in <module>
    AbortNodeTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 171, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 397, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 651, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 512, 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 115, in _request
    return self._get_response()
           ^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 206, in _get_response
    raise JSONRPCException(
test_framework.authproxy.JSONRPCException: non-JSON HTTP response with '503 Service Unavailable' from server (-342)
====== Bitcoin ABC functional tests: rpc_bind.py ======

------- Stdout: -------
2024-12-06T12:25:20.909000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20241206_122519/rpc_bind_3
2024-12-06T12:25:20.910000Z TestFramework (INFO): Check for linux
2024-12-06T12:25:20.910000Z TestFramework (INFO): Check for ipv6
2024-12-06T12:25:20.910000Z TestFramework (INFO): Check for non-loopback interface
2024-12-06T12:25:20.910000Z TestFramework (INFO): Bind test for []
2024-12-06T12:25:21.685000Z TestFramework (INFO): Bind test for []
2024-12-06T12:25:22.357000Z TestFramework (INFO): Bind test for ['[::1]']
2024-12-06T12:25:23.074000Z TestFramework (INFO): Bind test for ['127.0.0.1', '[::1]']
2024-12-06T12:25:23.807000Z TestFramework (INFO): Using interface 172.17.0.2 for testing
2024-12-06T12:25:23.807000Z TestFramework (INFO): Bind test for ['172.17.0.2']
2024-12-06T12:25:24.526000Z TestFramework (INFO): Allow IP test for 172.17.0.2:24193
2024-12-06T12:26:24.862000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
'''
2024-12-06T12:26:24.862000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 148, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 138, in _run_test_internal
    self.run_test()
  File "/work/test/functional/rpc_bind.py", line 153, in run_test
    self._run_nonloopback_tests()
  File "/work/test/functional/rpc_bind.py", line 217, in _run_nonloopback_tests
    self.run_allowip_test(
  File "/work/test/functional/rpc_bind.py", line 101, in run_allowip_test
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 655, in stop_nodes
    node.wait_until_stopped()
  File "/work/test/functional/test_framework/test_node.py", line 557, in wait_until_stopped
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 300, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
''' not true after 60.0 seconds
2024-12-06T12:26:24.914000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/rpc_bind.py", line 231, in <module>
    RPCBindTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 171, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 397, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 651, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 512, 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 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3.11/http/client.py", line 941, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
====== Bitcoin ABC functional tests: rpc_bind.py --nonloopback ======

------- Stdout: -------
2024-12-06T12:25:21.250000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20241206_122519/rpc_bind_6
2024-12-06T12:25:21.250000Z TestFramework (INFO): Check for linux
2024-12-06T12:25:21.250000Z TestFramework (INFO): Check for ipv6
2024-12-06T12:25:21.251000Z TestFramework (INFO): Check for non-loopback interface
2024-12-06T12:25:21.251000Z TestFramework (INFO): Using interface 172.17.0.2 for testing
2024-12-06T12:25:21.251000Z TestFramework (INFO): Bind test for ['172.17.0.2']
2024-12-06T12:25:22.111000Z TestFramework (INFO): Allow IP test for 172.17.0.2:24385
2024-12-06T12:26:22.669000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
'''
2024-12-06T12:26:22.669000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 148, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 138, in _run_test_internal
    self.run_test()
  File "/work/test/functional/rpc_bind.py", line 153, in run_test
    self._run_nonloopback_tests()
  File "/work/test/functional/rpc_bind.py", line 217, in _run_nonloopback_tests
    self.run_allowip_test(
  File "/work/test/functional/rpc_bind.py", line 101, in run_allowip_test
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 655, in stop_nodes
    node.wait_until_stopped()
  File "/work/test/functional/test_framework/test_node.py", line 557, in wait_until_stopped
    wait_until_helper(
  File "/work/test/functional/test_framework/util.py", line 300, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
    def is_node_stopped(self):
        """Checks whether the node has stopped.

        Returns True if the node has stopped. False otherwise.
        This method is responsible for freeing resources (self.process)."""
        if not self.running:
            return True
        return_code = self.process.poll()
        if return_code is None:
            return False

        # process has stopped. Assert that it didn't return an error code.
        assert return_code == 0, self._node_msg(
            f"Node returned non-zero exit code ({return_code}) when stopping"
        )
        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.log.debug("Node stopped")
        return True
''' not true after 60.0 seconds
2024-12-06T12:26:22.721000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/rpc_bind.py", line 231, in <module>
    RPCBindTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 171, in main
    exit_code = self.shutdown()
                ^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/test_framework.py", line 397, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 651, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 512, 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 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3.11/http/client.py", line 941, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Each failure log is accessible here:
Bitcoin ABC functional tests: feature_abortnode.py
Bitcoin ABC functional tests: rpc_bind.py
Bitcoin ABC functional tests: rpc_bind.py --nonloopback

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
Fabien requested changes to this revision.Fri, Dec 6, 13:36
Fabien added a subscriber: Fabien.

not sure why but this is causing issues on CI

This revision now requires changes to proceed.Fri, Dec 6, 13:36
This revision is now accepted and ready to land.Fri, Dec 6, 20:57
This revision was automatically updated to reflect the committed changes.