Skip to content

test: functional tests fail to start if -maxconnections is reduced #23968

@fanquake

Description

@fanquake

Noticed on NetBSD, but the same issue could happen on any other system. The issue is outputting the Reducing -maxconnections warning during startup:

bitcoin/src/init.cpp

Lines 893 to 898 in 2f37b22

if (nFD < MIN_CORE_FILEDESCRIPTORS)
return InitError(_("Not enough file descriptors available."));
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS - NUM_FDS_MESSAGE_CAPTURE, nMaxConnections);
if (nMaxConnections < nUserMaxConnections)
InitWarning(strprintf(_("Reducing -maxconnections from %d to %d, because of system limitations."), nUserMaxConnections, nMaxConnections));

Which causes the tests to abort, due to unexpected output:

python3.9 test/functional/test_runner.py --jobs=3           
Temporary test directory at /tmp/test_runner_₿_🏃_20220104_002803
Running Unit Tests for Test Framework Modules
..........
----------------------------------------------------------------------
Ran 10 tests in 1.310s

OK
Traceback (most recent call last):
  File "/home/ec2-user/bitcoin/test/functional/create_cache.py", line 27, in <module>
    CreateCache().main()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 155, in main
    exit_code = self.shutdown()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 304, in shutdown
    self.stop_nodes()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 555, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_node.py", line 336, in stop_node
    self.stop(wait=wait)
  File "/home/ec2-user/bitcoin/test/functional/test_framework/coverage.py", line 49, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/home/ec2-user/bitcoin/test/functional/test_framework/authproxy.py", line 142, in __call__
    response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
  File "/home/ec2-user/bitcoin/test/functional/test_framework/authproxy.py", line 107, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/pkg/lib/python3.9/http/client.py", line 1279, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/pkg/lib/python3.9/http/client.py", line 1325, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/pkg/lib/python3.9/http/client.py", line 1274, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/pkg/lib/python3.9/http/client.py", line 1034, in _send_output
    self.send(msg)
  File "/usr/pkg/lib/python3.9/http/client.py", line 974, in send
    self.connect()
  File "/usr/pkg/lib/python3.9/http/client.py", line 945, in connect
    self.sock = self._create_connection(
  File "/usr/pkg/lib/python3.9/socket.py", line 844, in create_connection
    raise err
  File "/usr/pkg/lib/python3.9/socket.py", line 832, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
2022-01-04T00:28:04.864000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20220104_002803/cache
2022-01-04T00:28:05.605000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main
    self.setup()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 287, in setup
    self.setup_chain()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 378, in setup_chain
    self._initialize_chain()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 792, in _initialize_chain
    self.stop_nodes()
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_framework.py", line 555, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/home/ec2-user/bitcoin/test/functional/test_framework/test_node.py", line 350, in stop_node
    raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr))
AssertionError: Unexpected stderr Warning: Reducing -maxconnections from 125 to 96, because of system limitations. != 
2022-01-04T00:28:05.663000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions