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

Open
hebasto wants to merge 3 commits from 261021-macos-netbsd into master AGit
hebasto commented 2026-10-21 07:32:06 +00:00 (Migrated from github.com)

This PR fixes the interface_ipc*.py tests, which have been failing on NetBSD since https://github.com/bitcoin/bitcoin/pull/35037.

As file descriptor budget regressions of this kind recur (see https://github.com/bitcoin/bitcoin/pull/31537 and https://github.com/bitcoin/bitcoin/pull/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.

This PR fixes the `interface_ipc*.py` tests, which have been [failing](https://github.com/bitcoin/bitcoin/pull/35037#issuecomment-6082043240) on NetBSD since https://github.com/bitcoin/bitcoin/pull/35037. As file descriptor budget regressions of this kind recur (see https://github.com/bitcoin/bitcoin/pull/31537 and https://github.com/bitcoin/bitcoin/pull/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.
DrahtBot commented 2026-10-21 07:32:25 +00:00 (Migrated from github.com)

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.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36587 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36587.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36587#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | Concept ACK | [Sjors](https://github.com/bitcoin/bitcoin/pull/36587#issuecomment-6460646505) | | Approach NACK | [fanquake](https://github.com/bitcoin/bitcoin/pull/36587#issuecomment-6913944031) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#31349](https://github.com/bitcoin/bitcoin/pull/31349) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/31349.svg"></sub> (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. <!--5faf32d7da4f0f540f40219e4f7537a3-->
hebasto commented 2026-10-21 07:42:57 +00:00 (Migrated from github.com)
NetBSD test logs are available here: https://github.com/hebasto/bitcoin-core-nightly/actions/runs/39563835829.
First-time contributor

Base: aa76bd266df9742a266d52e0e5da8dbf033658f6
Head: 311bc7c3bb274c7065f871198fa0910c205b8a6a

Findings

[Minor] Escape the wrapper path in BITCOIN_CMD

A checkout path containing whitespace makes functional-test nodes fail to start when CI_LIMIT_FD_COUNT is set; the default CI paths are unaffected.

Explanation and suggested change

When CI_LIMIT_FD_COUNT is set, this assigns the wrapper path to BITCOIN_CMD without escaping it. The test framework parses that variable with shlex.split, so a BASE_ROOT_DIR containing spaces splits the wrapper path into multiple arguments and node launches fail. Escape the wrapper path before adding it to BITCOIN_CMD, for example with printf -v wrapper '%q' "${BASE_ROOT_DIR}/ci/test/wrap-fd-limit.sh". The default GitHub and container CI paths contain no whitespace.

Location: ci/test/03_test_script.sh:163 (head).

Design and approach

Concept and approach. Keep the IPC budget fix and the macOS 256-descriptor cap, but restore coverage of feature_init.py's high-limit cases. The wrapper replaces the limits that the test sets, so those cases pass without exercising RLIM_INFINITY or 1<<31 node startups; add an uncapped feature_init.py rerun or another way for the test to bypass the wrapper. #36587 (comment)

Review coverage was incomplete.

Review limitations
  • design: The repository search for functional-test maxconnections overrides was cut off. A caller that relies on a bitcoin.conf override on an IPC-enabled node could change whether the new command-line default affects that test.
  • verifier: The inspection gap was not fully closed. A search for functional tests that set maxconnections and also enable ipcbind returned many unrelated locale matches. A test that relies on a bitcoin.conf maxconnections override on an IPC-enabled node was therefore not ruled out. Command-line -maxconnections added in TestNode.init comes before extra_args, so explicit command-line overrides should still take effect.
  • verifier: The checkout cannot confirm whether the GitHub macOS runner's hard RLIMIT_NOFILE is RLIM_INFINITY. It also cannot confirm that Linux CI hard limits make feature_init.py skip its RLIM_INFINITY and above-INT_MAX cases. The claim that the macOS job is the only CI job that actually exercises those cases is inferred.

Review tier: standard

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:ab973404fb8e3c0d560a5f0df76c1f96a2e0e21182cfc208ac10a039068cb623:00633cd9cb08c8f4661c30fbf00eaba6318f037423dd36deda26cc4a9d01c2c2 --> Base: `aa76bd266df9742a266d52e0e5da8dbf033658f6` Head: `311bc7c3bb274c7065f871198fa0910c205b8a6a` <!-- ralph-case:e020a1d052265ab601333d7567f6e951894d3b089440ab60ee646f8bbfbba16e --> ##### Findings **[Minor] Escape the wrapper path in `BITCOIN_CMD`** A checkout path containing whitespace makes functional-test nodes fail to start when `CI_LIMIT_FD_COUNT` is set; the default CI paths are unaffected. <details> <summary>Explanation and suggested change</summary> When `CI_LIMIT_FD_COUNT` is set, this assigns the wrapper path to `BITCOIN_CMD` without escaping it. The test framework parses that variable with `shlex.split`, so a `BASE_ROOT_DIR` containing spaces splits the wrapper path into multiple arguments and node launches fail. Escape the wrapper path before adding it to `BITCOIN_CMD`, for example with `printf -v wrapper '%q' "${BASE_ROOT_DIR}/ci/test/wrap-fd-limit.sh"`. The default GitHub and container CI paths contain no whitespace. Location: `ci/test/03_test_script.sh:163` (head). </details> ##### Design and approach **Concept and approach.** Keep the IPC budget fix and the macOS 256-descriptor cap, but restore coverage of `feature_init.py`'s high-limit cases. The wrapper replaces the limits that the test sets, so those cases pass without exercising `RLIM_INFINITY` or `1<<31` node startups; add an uncapped `feature_init.py` rerun or another way for the test to bypass the wrapper. https://git.fish.foo/bitcoin/bitcoin/pulls/36587#issuecomment-612762 Review coverage was incomplete. ##### Review limitations - design: The repository search for functional-test `maxconnections` overrides was cut off. A caller that relies on a bitcoin.conf override on an IPC-enabled node could change whether the new command-line default affects that test. - verifier: The inspection gap was not fully closed. A search for functional tests that set `maxconnections` and also enable `ipcbind` returned many unrelated locale matches. A test that relies on a bitcoin.conf `maxconnections` override on an IPC-enabled node was therefore not ruled out. Command-line `-maxconnections` added in TestNode.__init__ comes before `extra_args`, so explicit command-line overrides should still take effect. - verifier: The checkout cannot confirm whether the GitHub macOS runner's hard RLIMIT_NOFILE is RLIM_INFINITY. It also cannot confirm that Linux CI hard limits make feature_init.py skip its RLIM_INFINITY and above-INT_MAX cases. The claim that the macOS job is the only CI job that actually exercises those cases is inferred. Review tier: standard [Full review report](<https://review.fish.foo/traces/36587-311bc7c3bb274c7065f871198fa0910c205b8a6a-1547-2.html>)
Sjors commented 2026-10-28 04:26:19 +00:00 (Migrated from github.com)

Concept ACK

But wrap-fd-limit.sh‎ in 311bc7c3bb 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.

Concept ACK But `wrap-fd-limit.sh‎` in 311bc7c3bb274c7065f871198fa0910c205b8a6a loses our coverage for "infinite" file descriptors introduced by #34937. We could run `feature_init.py` both capped and uncapped: ```diff 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.
maflcko (Migrated from github.com) reviewed 2026-10-28 06:08:36 +00:00
maflcko (Migrated from github.com) commented 2026-10-28 06:08:36 +00:00

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

missing pipefail and nounset? I guess the script may fail anyway when nounset is hit, but can't hurt to be explicit here
fanquake commented 2026-11-16 10:32:13 +00:00 (Migrated from github.com)

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.

> 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 commented 2026-11-16 17:18:19 +00:00 (Migrated from github.com)

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.

> > 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](https://github.com/bitcoin/bitcoin/pull/36147). I would agree with this in an ideal world. However, a native NetBSD CI job [seems](https://github.com/bitcoin/bitcoin/pull/36147#issuecomment-6923551529) to be a hard goal for this project.
fanquake commented 2026-11-17 10:17:00 +00:00 (Migrated from github.com)

However, a native NetBSD CI job https://github.com/bitcoin/bitcoin/pull/36147#issuecomment-6923551529 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.

> However, a native NetBSD CI job https://github.com/bitcoin/bitcoin/pull/36147#issuecomment-6923551529 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 commented 2026-11-17 10:38:26 +00:00 (Migrated from github.com)

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?

> > 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](https://github.com/bitcoin/bitcoin/pull/36147). Would dropping the last commit from this PR change your mind?
maflcko commented 2026-11-17 11:38:37 +00:00 (Migrated from github.com)

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.

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 commented 2026-11-17 12:01:25 +00:00 (Migrated from github.com)

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().

> 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 in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36587
No description provided.