mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:47:36 +00:00
ci: add native freeBSD ci job #36147
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36147
Loading…
Reference in a new issue
No description provided.
Delete branch "bsd-ci"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This replaces the FreeBSD cross-compilation job with a native build and test job inside a FreeBSD VM. NetBSD and OpenBSD retain their existing cross-compilation jobs.
We currently cross-compile BSD binaries without testing them in this repository. Running tests before merge should help catch platform-specific regressions that would otherwise first appear in nightly builds. This starts with FreeBSD because it has been the most reliable BSD platform in the nightly jobs.
As we don't have native FreeBSD runners, the job uses vmactions/freebsd-vm, which is also used by the nightly builds. It reuses the existing CI scripts, depends build, and cache actions where possible.
The VM image is cached after its
preparestep installs dependencies. The job also restores and saves the usual build caches. Initial testing on free GitHub Actions runners took approximately 60 minutes without caches and 20–30 minutes with caches populated. Performance on Warp runners remains untested.The VM uses the runner's available CPU count and 75% of its RAM, leaving the remaining memory for the host and VM overhead. There is some overhead after testing while
rsynccopies cache directories back out of the VM.The patchset also suppresses
lsofwarnings on FreeBSD that would otherwise interfere with functional tests.The job requires enabling one additional action:
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.
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:
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.
I think this requires a stronger motivation, to explain that this will actually reduce overall workload.
Those vm-in-a-vm tests are extremely brittle (https://github.com/hebasto/bitcoin-core-nightly/issues/230#issuecomment-4311704411, https://github.com/hebasto/bitcoin-core-nightly/issues/81, ... etc)
So if those tasks are added here, we need to understand that this is the "hot path" (for all pull requests) and before this is merged, there needs to be several people who monitor those intermittent failures on those platforms and then categorize them into "intermittent", "unrelated", etc.
If this isn't done, then devs will just ignore all CI results because the false-positive rate is too high and just re-run it until it is green. This may then degrade non-*BSD code at a slight benefit of avoid some trivial test-only BSD fixups.
Maybe I am wrong, but I wanted to raise the point to not miss the large picture here.
We might begin with FreeBSD only, which has shown high stability over a long period.
Your link shows an unrelated failure for the 35th build (second page). Not sure if this is accurate, but if every 35th build fails and Bitcoin Core has 35 pushes per day, then every day there will be one additional unrelated CI failure.
Maybe there can be a one-month trial period and then a summary is presented with all CI failures and each of them annotated with "intermittent" (y/n), "unrelated" (y/n)?
Also, even if a failure is related, it can still be intermittent, so merging this pull request does not guarantee to prevent fixups such as https://github.com/bitcoin/bitcoin/pull/36145, because the failure happens intermittently.
I did not understand these VMs to be flaky. I didn't observe any flakiness in testing, but probably only ran about 15 runs (x3 jobs), so perhaps I'm due a random flake-failure soon 😋
The actions are used by a few other high-profile projects like tokio and sccache as well as:
But I'd imagine our functional tests put significantly more strain on the vm than any of those projects are doing.
I asked codex to take a look at the last months-worth of runs on hebasto's nightly repo:
Details
hebasto/bitcoin-core-nightlyfrom 2026-08-02 through 2026-09-02. Pull-request runs were excluded. The
nightly sample consists of runs with the
workflow_runevent. Manualworkflow_dispatchfailures are listed separately where they add usefulcontext.
Summary
The logs for all 29 failed runs were downloaded and inspected.
FreeBSD looks stable in this sample. NetBSD has a small number of nightly
failures, mostly caused by platform resource limits or platform-sensitive
tests. OpenBSD has a high failure rate, but most failures are repeatable test
or platform problems rather than failures to boot the VM.
NetBSD
Nightly failures
2026-08-25:
feature_block.pytimed out waiting for the expected peerdisconnect. Other jobs showed the NetBSD file-descriptor limit.
2026-08-20:
feature_block.pytimed out waiting for a peer disconnect afterthe node had rejected the block.
2026-08-14:
wallet_listtransactions.pyfailed whengenerateblockreturned
bad-txns-inputs-missingorspent.2026-08-10:
wallet_listtransactions.pyfailed with the sameTestBlockValidityerror.The
feature_block.pyfailures look like delayed networking or scheduling inthe guest: the node log records the rejection and disconnect, while the test
does not observe the disconnect before its timeout. The wallet failures are
functional test failures and should not be counted as generic VM boot
failures.
Manual failures
The following manual runs on 2026-08-25 failed during test setup because the
guest did not have enough file descriptors:
The common messages were:
These are reproducible NetBSD configuration or test-environment failures, not
random VM failures.
There was one additional manual failure:
2026-08-16: the VM boot probe timed out and QEMU was restarted. The run also
contained
feature_anchors.pyandinterface_http.pytiming failures.This is the clearest NetBSD example of actual VM or infrastructure flakiness.
OpenBSD
Repeated
interface_gui.pyfailuresinterface_gui.pyfailed in runs 738,739,
740,
743,
744,
745,
746,
747,
748,
749,
and 751.
The recurring error was:
This is highly repeatable across OpenBSD 7.8 and 7.9 GUI jobs. It looks like
an OpenBSD/Qt shutdown or test-environment problem, not QEMU randomly failing.
Repeated P2P test timeouts
p2p_private_broadcast.pyorp2p_private_broadcast_retry_v1.pyfailed in runs 738,754,
757,
758,
761,
765,
766,
772,
and 779.
The test waited exactly 480 seconds for all addresses to advertise
NODE_P2P_V2:The node remained responsive and answered
getnodeaddressesRPC requests, butthe expected service flags never appeared. Because the same test fails in the
same way across many consecutive OpenBSD runs, this looks like an OpenBSD/test
interaction or severe guest-performance problem rather than a generic boot
failure.
Package and VM infrastructure failures
OpenBSD package installation failed with
Premature end of archivewhileinstalling
nghttp2.765,
and 766:
package downloads included 404s or connection timeouts.
These failures are package-mirror or network infrastructure failures. They are
separate from the repeated functional test failures.
Conclusion
For this one-month sample:
resource-limit or functional-test issues. The one clear VM boot failure was
on 2026-08-16.
repeatable
interface_gui.pyandp2p_private_broadcast*failures, with afew package-mirror failures. It would be misleading to attribute all 19 to
vmactions or QEMU flakiness.
The next useful experiment would be to fix or disable the known OpenBSD GUI
and P2P test incompatibilities, raise the NetBSD file-descriptor limit, and
then repeat the same nightly comparison. That would leave a much cleaner
measurement of VM-level reliability.
I have not observed the interface_gui.py failures that hebasto's repo sees on OpenBSD. I did see a failure on p2p_private_broadcast_retry_v1.py once or twice and did have that test disabled on *BSD in one iteration; if that test in particular is flaky it could be disabled on these jobs.
Most of the other failures at first glance appear to be GHA/package archive 404 or other network infra failures and I wouldn't attribute them to the VMs being flaky, so I'm not 100% convinced that critique is warranted.
That said I don't want to add known-flaky jobs and you are correct to call out they could be more work to maintain than porting over a few fixes, if they are unreliable. I suppose the only unclear bit is at what cost level do we prefer to merge buggy code and fix later, vs run more jobs on every PR and merge to prevent that happening in the first place...
Happy to start with FreeBSD only if that's preferable.
Sure, I am not against this pull request, but then the motivation is off, because the two motivating issues are about netbsd and openbsd, which for some reason have a lot more false positive intermittent failures?
It still seems that the remaining fixups required for FreeBSD are less effort than maintaining the FreeBSD ci task here? (Recall that codex only looked at the last month with daily builds, but it missed the failure from 35 days ago and recall that Bitcoin Core has a higher CI volume than just one build per day, so any rare failure will amplify)
Again, seems fine to merge this, but as long as the false positive rate is higher than the true positive rate, it doesn't seem worth it overall.
🐙 This pull request conflicts with the target branch and needs rebase.
Scanning the last 90 days (where logs still exist) in hebasto's repo I really only see this one where the vm failed to boot: https://github.com/hebasto/bitcoin-core-nightly/actions/runs/29139756629/job/86510586228#step:2:188
There are a handful of "random" functional test issues, which could be attributable to the vm-in-vm setup, but I'd recommend disabling those few tests. There are a number of legitimate functional test failures repeated over many days (e.g interface_gui.py) and few semi-legitimate-looking errors which could have been vm-flakiness.
Including the ~legit test timeout-type failures, but excluding real test failures by my count I see 18 "flaky failures" out of 812 jobs over the 90 days, which or 2.2%.
Our CI jobs have between a 7 and 2% fail rate (assuming all current failures are true-positives), per our CI job statistics.
So for references 2.2% as a potential false-positive rate is ~ in the same ballpark as the true-failures we see on jobs today (assuming all are true-failures). I agree a flakiness ~= to the bug-catching ability of non-flaky tests isn't great.
If we are more happy to backport fixes from broken nightly/master builds than run CI jobs here as we are worried they'll be too flaky (which is more like a regular CI/CD process to be honest) then that works for me too.
I'll leave this in draft for a few days in case anyone else wants to weigh in, before closing.
Concept ACK on having at least one CI job that runs tests on a *BSD platform.
Is this the average over all BSDs? Because I see 5 OpenBSD failures in the last 10 days alone, which is more than 10%.
I guess we could add the FreeBSD one only, but I wonder what issues it would have caught this year. Mostly only https://github.com/bitcoin/bitcoin/issues/34331?
I'd say we don't care about FreeBSD failures that happen on other platforms as well, so true positive rate is meant as the "marginal" (additional or exclusive) true positive rate.
I guess it could be tried for a month or two, to see what happens in reality.
There is still a flood of unexplained FreeBSD failures:
I think those should be fixed first.
Maybe this can be closed in the meantime?
I hope to collect more logs when a failure happens next time.
Sure, logging can't hurt, but I don't think it is possible to fix the OOM or OOS like
System.IO.IOException: No space left on device : '/home/runner/actions-runner/cached/2.338.2/_diag/Worker_20261102-062353-utc.log'Earlier concerns neither republished nor resolved: 3 suggestions. See the Run archive linked from the Review report for their assessments.
🔴 Major · The submitted
NOMERGEconfiguration disables the existing CI suiteThe submitted head disables all existing CI jobs and schedules 25 identical FreeBSD trials on each eligible event, removing the existing platform, sanitizer, and lint coverage.
Location:
.github/workflows/ci.yml:405(head).🔵 Suggestion · The new VM action inherits an implicit token scope
The host-side
vmactions/freebsd-vm@v1step inherits token permissions and shares a default-branch cache-publishing job; its actual write authority depends on repository defaults and cache-provider scoping.Location:
.github/workflows/ci.yml:627(head).🔵 Suggestion · Python and its modules use inconsistent version selectors
lang/python3follows the ports default while its module packages are fixed to Python 3.12, so a default-version change can fail VM preparation; no such failure was observed.Location:
ci/test/00_setup_env_freebsd_native.sh:11(head).🔵 Suggestion · Shared CI behavior changes are buried in the FreeBSD job commit
e6b63bfchanges shared diagnostics and stops clearingCONFIG_SHELLfor non-Alpine depends builds, but its message does not explain those effects on existing jobs.Location: ci/test/03_test_script.sh:94 (commit).
🔵 Suggestion · Autosquash would discard the routable-alias rationale
The routable-alias fixup explains a non-obvious prerequisite for running
feature_bind_port_discover.py; preserve that explanation when squashing it into the native-job commit.Location: .github/workflows/ci.yml:584 (commit).
Review coverage was incomplete.
Reviewed:
a6f5aa9d44c2· Review report · Previous reportspermalink
Isn't that kind of issue a problem with the nightly build infrastructure itself? My recollection is that a lot, if not most, of the issues from that repo have been of a similar nature (timeouts, OOM, out of space, flakiness/can't reproduce) and point to it being under-resourced/unstable, rather than some fundamental problem with these operating systems?
Right, so if this pull is merged, we'll have to deal with a flood of meaningless false reports instead of any real issues that would happen on those systems.
Why? We can pay for (reliable) CPU and enough disk space to be able to properly run tests; and I don't see why anything would be merged if the expectation was it'd just produce pointless noise.
If anything, it would seem better to have the tests run properly here, than improperly in a different repo, and still have to deal with all the false reports?
Ok, I am not sure if the better hardware will propagate into the double-nested VM (if the inner VM is set up with fixed hard-coded resources), but I guess it seems fine to try and then revert if it doesn't work.
concept ACK, especially with the recent socket stuff the nightly BSD builds as well as individual reviewers are finding things. If we support BSDs I think it would be great to have CI, will review.
Maybe there can be a temp commit on top to spawn a matrix with 100 or 200 tasks for freebsd (or whatever is added) to see if there are any nested vm crashes?
Concept ACK
🐙 This pull request conflicts with the target branch and needs rebase.
Maybe time to extract this as a named template?
untested diff:
yeah nice, can do that on the next push :)
done
I mark this as ready for review now, but it will need the
vmactions/freebsd-vm@v1action approved to be able to run on our CI here.left some more questions
do we want to document "dangerous" stuff?
Also, the docs are wrong to suggest that a manual install is needed?
Can the commit msg explain this? Why is this needed here, when https://github.com/hebasto/bitcoin-core-nightly/actions/runs/43818975249/workflow doesn't need it?
this change seems wrong? Why not just install nproc?
i don't really like adding more special-case CI code. Just use the existing code and install lscpu from ports? Also, could just use uname -sr then?
Add a rationale?
Can the commit message explain what warning this is and maybe also why https://github.com/hebasto/bitcoin-core-nightly/actions/runs/43818975249/workflow does'nt need it?
I see the pull description mentions this, but it would be better to remove it there and mention it here, and be a bit more specific. Is this https://github.com/bitcoin/bitcoin/issues/36099?
See also #36587, where we are trying to test NetBSD via the macOS CI.
Well I was thinking that the manual-install instruction was useful because the scripts skip package installation on BSD; the GitHub workflow installs packages separately during VM preparation.
But I think removing it is fine.
Yep, I don't think it's needed after all. Removed. Also reverted the CPU-detection fallback change, since FreeBSD provides nproc.
Also reverted. From what I can see
nprocis already installed on 15.1Added
sysutils/lscpuand shared thelscpuanduname -srcalls with Linux. Kept a small FreeBSD branch for memory reporting: sysctl hw.physmem though since the existingfree -m -his Linux-specific.LMK if you know a way around that one.
I don't recall why I added this, so going to remove for now.
I'd prefer to keep this, so expanded the commit message.
The test runner treats nonempty stderr as failure even when the test exits successfully. hebatos nightly works around this by running feature_bind_extra and rpc_bind separately with -j1. Here, -w suppresses the warning about lock information while keeping the socket-address assertions, which seems nicer to me?
This let's us keep things more parallelised here.
@maflcko I opted to run 20 jobs here as a trial. If they're all successful then I can bump and re-run.
What level of robustness do you think we should aim for here? I calculate that running 200 jobs with 95% confidence would put our failure rate below ~1.5%. (and 299 runs would put it at 99% reliable).
why is this needed?
Why is this logic change needed? Maybe just write "done" to
"${BASE_ROOT_DIR}/ci.base-install-done"?why is this needed?
I guess this was always wrong. Could drop the
-mand usefree --humanwhile touching this?concept ACK
That seems a bit hacky? And given that it triggers a "bug" in fontconfig, I always wondered if an empty string as the shell should be supported even?
Why not
SHELL_OPTS=""for non-Alpine?lgtm. I haven't reviewed this, but it appears fine
FWIW, https://github.com/hebasto/bitcoin-core-nightly/blob/main/.github/workflows/freebsd.yml does not use such a hack.
In my experience, 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.
I wonder how much time this caching saves us.
Is there any CI job where
gmakedoesn't work?Specifically for FreeBSD, we might want to be explicit about the filesystem being used (UFS vs ZFS), because the availability of
posix_fallocate()depends on it.Related: https://github.com/bitcoin/bitcoin/issues/33128.
I think sticking with UFS is the better choice here, would you agree?
This means BSD_RELEASE just stays as
15.1; would you like a code comment next to it?If we are going to add a single new job, I’d prefer that it increase our test coverage. A job using 15.1-zfs would be the only one that covers code paths where the
HAVE_POSIX_FALLOCATEmacro is undefined. Of course, this means that thefeature_reindex_init.pyfunctional test would have to be temporarily disabled until https://github.com/bitcoin/bitcoin/issues/33128 is fixed.Why is increasing test coverage here, dependant on filesystem? We are increasing test coverage in any case?
posix_fallocate()is disabled for ZFS on FreeBSD, so this job exercises a code path that none of the other CI jobs currently tests:github.com/bitcoin/bitcoin@e211dd0186/src/util/fs_helpers.cpp (L229-L241)Sure, but this is also increasing test coverage, by just running any FreeBSD tests.
I mean additional coverage.
Apparently,
rsyncis very flaky.That was one of the reasons I dropped Ccache caching from the nightly builds.
OK getting rid of the flaky "rsync the entire guest back to host" step has made this a lot more robust:
https://github.com/bitcoin/bitcoin/actions/runs/44088352617
https://github.com/bitcoin/bitcoin/actions/runs/44135481013
Those two runs also checked cache save/restore.
Will run some more tests.
Pull description is outdated wrt excluded functional tests? Also the test fails in https://github.com/bitcoin/bitcoin/actions/runs/44270200782/job/134684598246?pr=36147#step:9:4241:
test failure
Right, I think this is because BSD has a different ephemeral port range by default vs linux and one clashed. Will try a small fix.
Doesn't
set_ephemeral_port_range()do its work?I don't know, but this looked like it was connecting to something else to me: https://github.com/bitcoin/bitcoin/actions/runs/44270200782/job/134684598246?pr=36147#step:9:4243
I'm concerned about the sizes of the caches created by
vmactions/freebsd-vm.The first cache, which "caches
aptpackages on the host and VM images/artifacts", is about 1.0 GB.The second one,
cache-after-prepare, takes 1.6 GB.In my year of experience with this action, I really can't see the need for either of them. Starting a FreeBSD VM with a non-trivial
prepareinput usually takes under 2 minutes.Approach ACK
606f39f3b8.Checked Ccache in my personal repo. The second run on the same commit looks nice:
I will drop the vm caches here.
I think I will also (optimistically) rebase this on top of #36916 which I think addresses the port collisions correctly (and certainly a lot more cleanly than the previous hack in this PR).
For this job it takes 7..8 minutes. It seems acceptable for me.
going to leave this in draft to focus on #36916 first
Maybe undraft?
Undrafted.
The one failing run previously seems to have just timed out (or errored) on
pkg install. Could be a server error or something else. I considered adding a retry here, but according to the manpagepkg installalready retries 3 times.I did make a small tweak to the python packages though, selecting them by python version. This might be error-prone (and we might therefore want to revert), but it does avoid downloading these packages for multiple python versions; apparently these packages cover 6 or 7 python versions each?
When would that happen? Do I understand correctly that sometimes it would download
py312-sqlite3and in another occasion e.g.py314-sqlite3?Ah not quite (but also not quite how I originally understood it, too):
See for example
github.com/freebsd/freebsd-ports@3c9affb17b/databases/py-sqlite3/Makefile (L20)which specifiesUSE_PYTHON= allflavors autoplist pep517(feeding into this).So
databases/py-sqlite3requests all available flavours of Python’s sqlite3 module, which downloads multiple python interpreters AFAICT, e.g. in the failed run: 3.11, 3.12, 3.13, 3.13t, 3.14, 3.14t, and 3.15. linkThe other python packages do not set this in their builds/do this. I moved all python packages to this type only for consistency.
🚧 At least one of the CI tasks failed.
Task
FreeBSD 24: https://github.com/bitcoin/bitcoin/actions/runs/46913037948/job/143573391103LLM reason (✨ experimental): functional_test_fail:
feature_torcontrol.pyfailed because its mock Tor service could not bind the control port:Address already in use.Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
Intermittent network issues can occur; re-run CI for now, and report the issue if they keep happening.
A functional or integration test failure may be intermittent or unrelated to this pull request.
If no dedicated issue thread exists, create a new one to track it.
Leave a comment here, if you need help tracking down a confusing failure.
Right,
databases/py-sqlite3pulls in all flavors which even if benign looks excessive. Can usedatabases/py-sqlite3@py314instead and definepy314in a separate variable and suffix all python packages with it, so that when it has to be changed, it's only in one place.Maybe omit
lang/python3because its proper version will be pulled by the other py packages, e.g. bydatabases/py-sqlite3@py314orpy314-sqlite3.