Skip to content

Commit d9d5bc2

Browse files
committed
qa: Limit -maxconnections in tests
On systems such as NetBSD, this change enables the execution of functional tests.
1 parent c1252b1 commit d9d5bc2

File tree

1 file changed

+11
-0
lines changed
  • test/functional/test_framework

1 file changed

+11
-0
lines changed

test/functional/test_framework/util.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,17 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
453453
f.write("unsafesqlitesync=1\n")
454454
if disable_autoconnect:
455455
f.write("connect=0\n")
456+
# Limit max connections to mitigate test failures on some systems caused by the warning:
457+
# "Warning: Reducing -maxconnections from <...> to <...> due to system limitations".
458+
# The value is calculated as follows:
459+
# available_fds = 256 // Same as FD_SETSIZE on NetBSD.
460+
# MIN_CORE_FDS = 151 // Number of file descriptors required for core functionality.
461+
# MAX_ADDNODE_CONNECTIONS = 8 // Maximum number of -addnode outgoing nodes.
462+
# nBind == 3 // Maximum number of bound interfaces used in a test.
463+
#
464+
# min_required_fds = MIN_CORE_FDS + MAX_ADDNODE_CONNECTIONS + nBind = 151 + 8 + 3 = 162;
465+
# nMaxConnections = available_fds - min_required_fds = 256 - 161 = 94;
466+
f.write("maxconnections=94\n")
456467
f.write(extra_config)
457468

458469

0 commit comments

Comments
 (0)