From d9d5bc2e7466033d989432f53a112325fa3d6d4a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:01:27 +0000 Subject: [PATCH] qa: Limit `-maxconnections` in tests On systems such as NetBSD, this change enables the execution of functional tests. --- test/functional/test_framework/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index ab2a5d38d6..14930ef671 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -453,6 +453,17 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect= f.write("unsafesqlitesync=1\n") if disable_autoconnect: f.write("connect=0\n") + # Limit max connections to mitigate test failures on some systems caused by the warning: + # "Warning: Reducing -maxconnections from <...> to <...> due to system limitations". + # The value is calculated as follows: + # available_fds = 256 // Same as FD_SETSIZE on NetBSD. + # MIN_CORE_FDS = 151 // Number of file descriptors required for core functionality. + # MAX_ADDNODE_CONNECTIONS = 8 // Maximum number of -addnode outgoing nodes. + # nBind == 3 // Maximum number of bound interfaces used in a test. + # + # min_required_fds = MIN_CORE_FDS + MAX_ADDNODE_CONNECTIONS + nBind = 151 + 8 + 3 = 162; + # nMaxConnections = available_fds - min_required_fds = 256 - 161 = 94; + f.write("maxconnections=94\n") f.write(extra_config)