Repository navigation
ci: add native freeBSD ci job - #36147
willcl-ark wants to merge 5 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, 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 (hebasto/bitcoin-core-nightly#230 (comment), hebasto/bitcoin-core-nightly#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 #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
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 NetBSDNightly failures
The Manual failuresThe following manual runs on 2026-08-25 failed during test setup because the The common messages were: These are reproducible NetBSD configuration or test-environment failures, not There was one additional manual failure:
This is the clearest NetBSD example of actual VM or infrastructure flakiness. OpenBSDRepeated
|
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. |
|
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 #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 |
|
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 |
|
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 |
41c4df2 test: avoid BSD ephemeral-port collisions in HTTP clients (will) Pull request description: While stress-testing #36147 I noticed sporadic port collisions still occurring on FreeBSD. `set_ephemeral_port_range()` keeps the source port out of the test port range, but only for sockets the framework creates itself. Python's `http.client` creates its sockets internally, so RPC and REST connections can still be given a source port inside the test range. A connection to a closed port can then connect to itself. For example, the wrong-RPC-port startup check failed with `BadStatusLine: POST / HTTP/1.1` because the client read back its own request. This change adds a `netutil.HTTPConnection` subclass that sets the port range before connecting, and uses it in `AuthServiceProxy` and in the tests that open HTTP connections directly. HTTPS is left unchanged because we don't serve RPC over TLS so it seems unnecessary. ACKs for top commit: hebasto: re-ACK 41c4df2. Tree-SHA512: c39a61977e5b00907bda34040addf9cfce9c7502b08d7879e2fe504351d79d89b223ec487840a40296187b82e8dc2b0844d5060467b8c6c5b2e5886daae3ee8c
FreeBSD lsof can emit the following warning during parallel tests:
lsof: WARNING -- reading lockf list failed: Cannot allocate memory
The functional test runner treats nonempty stderr as failure even when a
test exits successfully.
The lock information is separate from the TCP listener addresses queried
by get_bind_addrs, so suppress lsof warnings for this query while
retaining the tests' socket-address assertions.
Maybe undraft? |
|
Undrafted. The one failing run previously seems to have just timed out (or errored) on 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 |
Keep NetBSD and OpenBSD on their existing cross-compiled jobs. Run the full test suite natively on FreeBSD.
Because the FreeBSD job sets DANGER_RUN_CI_ON_HOST=1, 02_run_container.py does not assign BIND_TEST_ROUTABLE_IPV4 or BIND_TEST_ROUTABLE_IPV6, so feature_bind_port_discover.py skips by default. Add its documented routable aliases to the VM's default interface during preparation so the test runs and exercises FreeBSD's getifaddrs discovery path.
Repeat the native FreeBSD job to assess selective cache retrieval without spending runner time on unrelated jobs. Keep all temporary trial controls in this commit so dropping it restores the normal CI configuration.
Ah not quite (but also not quite how I originally understood it, too): See for example https://github.com/freebsd/freebsd-ports/blob/3c9affb17b35421840c24a176ebe2c8883a67ffe/databases/py-sqlite3/Makefile#L20 which specifies So The 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. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
Right, Maybe omit |

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: