Skip to content

qa: Fix interface_ipc*.py on NetBSD and prevent future regressions - #36587

Open
hebasto wants to merge 3 commits into
bitcoin:masterfrom
hebasto:261021-macos-netbsd
Open

hebasto wants to merge 3 commits into
bitcoin:masterfrom
hebasto:261021-macos-netbsd

Conversation

@hebasto

@hebasto hebasto commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

This PR fixes the interface_ipc*.py tests, which have been failing on NetBSD since #35037.

As file descriptor budget regressions of this kind recur (see #31537 and #36078), the macOS CI job now models NetBSD's limit so they are caught before merging rather than by nightly NetBSD CI afterwards.

See the commit messages for details.

Easy to review using the following:
```
git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change
```
Since `-ipcbind` reserves one listening socket plus
`ipc::DEFAULT_MAX_CONNECTIONS` (16) client slots in `min_required_fds`,
the framework's `-maxconnections=76` no longer fits the 256 file
descriptor budget on NetBSD, and every `interface_ipc*.py` node starts
with "Warning: Reducing -maxconnections ...", which the framework treats
as a failure.

Lower `-maxconnections` by that reservation on IPC-enabled nodes only,
so the rest of the suite keeps its P2P connection slots.
On select()-based platforms such as NetBSD, `bitcoind` can use at most
`FD_SETSIZE` (256) file descriptors, so the functional test framework
pins `-maxconnections` to that budget. Any change that grows
`min_required_fds` then makes every node print "Warning: Reducing
-maxconnections ...", which the framework treats as a failure. Such
regressions are currently caught only by nightly NetBSD CI (see bitcoin#31537,

Add a `CI_LIMIT_FD_COUNT` knob that runs functional test node processes
through a wrapper capping `RLIMIT_NOFILE`, and enable it for the macOS
native job with NetBSD's value of 256.
@DrahtBot DrahtBot added the Tests label Oct 21, 2026
@DrahtBot

DrahtBot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept ACK Sjors
Approach NACK fanquake

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31349 (ci: detect outbound internet traffic generated while running tests by vasild)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto hebasto changed the title qa: Fix interface_ipc*.py on NetBSD and prevent r qa: Fix interface_ipc*.py on NetBSD and prevent future regressions Oct 21, 2026
@hebasto hebasto closed this Oct 21, 2026
@hebasto hebasto reopened this Oct 21, 2026
@hebasto

hebasto commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

hebasto pushed a commit to hebasto/bitcoin-core-nightly that referenced this pull request Oct 22, 2026
All four NetBSD nightly jobs fail because `interface_ipc.py`,
`interface_ipc_cli.py`, `interface_ipc_init.py` and
`interface_ipc_mining.py` do not expect the
"Reducing -maxconnections ... because of system limitations" warning
that bitcoind prints on NetBSD.

The proper fix is bitcoin/bitcoin#36587. Exclude these tests until it
is merged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TyGMUZrBWNjnUxbpmu16D9
hebasto pushed a commit to hebasto/bitcoin-core-nightly that referenced this pull request Oct 23, 2026
Nodes started with `-ipcbind` reserve 17 more file descriptors than
the `maxconnections=76` budget in the functional test framework
accounts for. On NetBSD (FD_SETSIZE = 256) bitcoind therefore prints
the "Reducing -maxconnections ..." warning on stderr and the
`interface_ipc*` tests fail.

Apply a minimal version of bitcoin/bitcoin#36587 to the fetched source
tree: lower `-maxconnections` for `-ipcbind` nodes. This keeps the
tests running on NetBSD until the upstream fix is merged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TyGMUZrBWNjnUxbpmu16D9
@Sjors

Sjors commented Oct 28, 2026

Copy link
Copy Markdown
Member

Concept ACK

But wrap-fd-limit.sh‎ in 311bc7c loses our coverage for "infinite" file descriptors introduced by #34937.

We could run feature_init.py both capped and uncapped:

diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh
index d5981147f4..1468638690 100755
--- a/ci/test/03_test_script.sh
+++ b/ci/test/03_test_script.sh
@@ -161,5 +161,6 @@ if [ -n "${CI_LIMIT_FD_COUNT}" ]; then
   # Only the node processes are capped (via BITCOIN_CMD), not the Python
   # test runner, which needs more descriptors when running jobs in parallel.
-  export BITCOIN_CMD="${BASE_ROOT_DIR}/ci/test/wrap-fd-limit.sh ${BITCOIN_CMD:-bitcoin}"
+  BITCOIN_CMD_UNCAPPED="${BITCOIN_CMD:-bitcoin}"
+  export BITCOIN_CMD="${BASE_ROOT_DIR}/ci/test/wrap-fd-limit.sh ${BITCOIN_CMD_UNCAPPED}"
 fi
 
@@ -208,4 +209,20 @@ if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
     --quiet \
     --failfast
+
+  if [ -n "${CI_LIMIT_FD_COUNT}" ]; then
+    # The capped suite also runs feature_init.py, but the wrapper overrides the
+    # RLIM_INFINITY and above-INT_MAX limits it tests. Repeat it without the cap.
+    BITCOIN_CMD="${BITCOIN_CMD_UNCAPPED}" \
+    LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
+    "${BASE_BUILD_DIR}/test/functional/test_runner.py" \
+      "${MAKEJOBS}" \
+      --tmpdirprefix "${BASE_SCRATCH_DIR}/test_runner_uncapped/" \
+      --ansi \
+      --combinedlogslen=99999999 \
+      --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" \
+      --quiet \
+      --failfast \
+      feature_init.py
+  fi
 fi

Alternatively we could drop that test.

Comment thread ci/test/wrap-fd-limit.sh
# caught by this job instead of only on NetBSD.

export LC_ALL=C.UTF-8
set -o errexit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing pipefail and nounset? I guess the script may fail anyway when nounset is hit, but can't hurt to be explicit here

@fanquake

Copy link
Copy Markdown
Member

the macOS CI job now models NetBSD's limit so they are caught before merging

Approach NACK. Rather than hijacking tests we already have, to emulate the constraints of other operating systems, we should add proper tests for things we are claiming/trying to support i.e #36147.

@hebasto

hebasto commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

the macOS CI job now models NetBSD's limit so they are caught before merging

Approach NACK. Rather than hijacking tests we already have, to emulate the constraints of other operating systems, we should add proper tests for things we are claiming/trying to support i.e #36147.

I would agree with this in an ideal world. However, a native NetBSD CI job seems to be a hard goal for this project.

@fanquake

Copy link
Copy Markdown
Member

However, a native NetBSD CI job #36147 (comment) to be a hard goal for this project.

NetBSD’s infrastructure is the least reliable of the three, compared with FreeBSD’s and OpenBSD’s. A significant share of NetBSD nightly jobs fail because of package installation failures.

Shouldn't that problem be solved at a different layer? If the problem is infrastructure, introduce more caching, or prebuilt/reusable container images, rather than trying to push complexity into unrelated tests.

@hebasto

hebasto commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

the macOS CI job now models NetBSD's limit so they are caught before merging

Approach NACK. Rather than hijacking tests we already have, to emulate the constraints of other operating systems, we should add proper tests for things we are claiming/trying to support i.e #36147.

Would dropping the last commit from this PR change your mind?

@maflcko

maflcko commented Nov 17, 2026

Copy link
Copy Markdown
Member

It seems plausible that a user is running the tests with a fd limit on any select based OS. If we want to support that, it seems fine to add it to the CI. Using any CI config for that seems fine, given that such a user may be on any of those OS's.

@fanquake

Copy link
Copy Markdown
Member

running the tests with a fd limit on any select based OS. If we want to support that,

It's not clear we do (#36761). We may move away from select() on macOS (and all other OS's), so I don't think adding new test coverage for select on NetBSD, via macOS is a great approach. It seems like it would be more productive to work on switching NetBSD to poll()?

If we do still want to do this, it seems like it should be in it's own, isolated test, which will not interfere with any poll() migration, so we can avoid any concerns about "losing coverage", if macOS was migrated away from select().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants