Repository navigation
ci: link macOS libevent and memtier against the same OpenSSL - #675
Merged
Merged
Conversation
Homebrew's libevent 2.1.13_1 now depends on openssl@4, but the build-macos "3" cell still built memtier against openssl@3 with Homebrew libevent. The process loaded two libssl copies and passed an OpenSSL 3 SSL* to libevent's OpenSSL 4 bufferevent_openssl code, so socket_options_test segfaulted on every runner with the new bottle. - build-macos: the 3.0 and 3 cells build libevent from source against the cell's OpenSSL. A new 4 cell uses Homebrew libevent with openssl@4, which is Homebrew's consistent pair and what DEVELOPMENT.md now recommends. - Run scripts/check-macos-tls-links.sh after Build and before the unit tests in all macOS jobs, so a library mismatch fails with a clear message instead of a crash. - check-macos-tls-links.sh now prints the otool output of each checked library, requires memtier to link libevent_openssl, and requires both memtier and libevent_openssl to link libssl from the expected prefix. - DEVELOPMENT.md: use openssl@4 with Homebrew libevent and explain how to use another OpenSSL. Fixes #674 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first CI run showed the runner's Homebrew still serving libevent 2.1.13 (openssl@3) to the new openssl@4 cell, so which OpenSSL Homebrew libevent links depends on the runner snapshot. The link check caught it before the tests. Build libevent against the cell's OpenSSL in every cell, and tell DEVELOPMENT.md readers to check brew deps libevent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- build-macos-libevent.sh: create RUNNER_TEMP before downloading, so the DEVELOPMENT.md recipe works on a clean machine. - DEVELOPMENT.md: install the alternative OpenSSL first. - Drop the otool -L greps in build-macos-openssl-1-1; the link check prints otool -L itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build memtier exactly as DEVELOPMENT.md says: Homebrew libevent and the OpenSSL it depends on (brew deps libevent), with the link check before the unit tests. The pairing follows Homebrew automatically. Also build the source libevent with --disable-debug-mode, matching the formula. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… errors DEVELOPMENT.md hard-coded openssl@4, but the OpenSSL Homebrew libevent links depends on its revision (today's runner still had openssl@3). Derive it with brew deps exactly as the CI job does, and show how to run check-macos-tls-links.sh after building. The link check now names the library and the expected prefix in its errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Re-running the script into the same RUNNER_TEMP with another OpenSSL kept the old objects (tar restores timestamps, config.h is unchanged), so the old libevent_openssl was reinstalled. Remove the script's own build and install directories first. Also print a message when brew deps libevent lists no OpenSSL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
build-macos (3)failsmake checkwithsocket_options_testdying on SIGSEGV on every runner that installs Homebrew'slibevent 2.1.13_1bottle (#674). It intermittently reds every PR's macOS cell, depending on which bottle the runner gets.Root cause
Homebrew moved
libeventtoopenssl@4(revision 1). The3cell still configured memtier againstopenssl@3with Homebrew libevent, so one process loaded two libssl copies and passed an OpenSSL 3SSL *to libevent's OpenSSL 4bufferevent_opensslcode.scripts/check-macos-tls-links.shwould have caught it, but ran after the unit tests, so the crash came first.Fix
build-macosmatrix is now["3.0", "3", "4"], and every cell builds libevent from source against the cell's OpenSSL (scripts/build-macos-libevent.sh, which the3.0cell already used). Homebrew libevent is no longer used there. The first CI run of this PR showed why: on that runner,brew install libeventstill served the old2.1.13bottle (openssl@3) to an openssl@4 cell. Which OpenSSL Homebrew libevent links depends on the runner's Homebrew snapshot, so it cannot be pinned. The new4cell adds OpenSSL 4 coverage. homebrew-core already ships memtier with openssl@4.build-macos-homebrew-libeventtests the documented Homebrew path. It runsbrew install libevent, picks the OpenSSL withbrew deps libevent | grep '^openssl@', configures memtier against that OpenSSL, and runs the link check with"$(brew --prefix libevent)"beforemake check. The pairing follows Homebrew automatically. Thebuild-macosmatrix cells use source-built libevent, so their results do not depend on the runner's Homebrew snapshot.build-macos,build-macos-openssl-1-1,build-macos-openssl-1-0-2). A mismatch fails with<library>: unexpected OpenSSL dependency <path> (expected under <prefix>)instead of a segfault.check-macos-tls-links.shprintsotool -Lfor memtier and for every libevent dylib it links. It requires memtier to linklibevent_openssl, and it requires both memtier andlibevent_opensslto linklibsslfrom the expected OpenSSL prefix.ssl=$(brew deps libevent | grep '^openssl@' | head -n 1)), or build libevent from source for any other OpenSSL. Each recipe ends with the matchingcheck-macos-tls-links.shcommand.Interaction with #545: the open PR #545 also changes
scripts/build-macos-libevent.sh(to a CMake helper), the ci.ymlbrew installline and DEVELOPMENT.md. Its macOS doc (Homebrew libevent + openssl@3) would reintroduce #674, so whichever PR lands second must resolve this deliberately.Test evidence
macOS cannot be run locally, so CI is the validation.
The link check detects the #674 mix on a real runner. In run 38696566251 (first commit, where the
4cell used Homebrew libevent), job 116294385830 failed in the link-check step before any test ran:The first run's messages predate the reworded errors, which now name the library and the expected prefix.
Run 38700109572 (head 9b6e9f1): all six macOS jobs pass. In every job the link check passes before
make check, andmake checkreports 7/7 tests passing, includingsocket_options_test. memtier andlibevent_openssllink a single libssl:--versionopenssl/opt/homebrew/opt/[email protected]/lib/libssl.3.dylib/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib/opt/homebrew/opt/openssl@4/lib/libssl.4.dylib/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib/opt/homebrew/opt/[email protected]/lib/libssl.1.1.dylib/opt/homebrew/opt/[email protected]/lib/libssl.1.0.0.dylibOn this runner Homebrew still served the old libevent bottle, which links openssl@3, so the Homebrew job picked openssl@3. OpenSSL 4 is therefore covered only by the source-built
build-macos (4)cell. Once runners getlibevent 2.1.13_1, the Homebrew job will pick openssl@4 on its own.I also checked the script on Linux with a stub
otool: memtier -> openssl@3 withlibevent_openssl-> openssl@4 exits 1, and the matching pair exits 0.Fixes #674
Affected versions
master only (CI only); no release is affected.
brew install libevent+openssl@3CI cell came in with 76b2b8f (Initialize TCP keepalive and no-delay socket options #541), which no release tag contains. The crash started when Homebrew publishedlibevent 2.1.13_1(OpenSSL 4) on 2026-10-08.[email protected]) get the same mixed-OpenSSL binary once their Homebrew libevent is on openssl@4. This is derived from the CI evidence and was not run. The DEVELOPMENT.md change addresses it.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to macOS CI, helper scripts, and developer docs; no runtime application code is modified.
Overview
Fixes intermittent macOS CI failures (#674) where memtier and Homebrew libevent linked different OpenSSL copies and TLS unit tests segfaulted instead of failing clearly.
CI: The
build-macosmatrix now includes OpenSSL 4 and every cell builds libevent from source against that cell’s OpenSSL (Homebrew libevent is no longer used there). A newbuild-macos-homebrew-libeventjob covers the documented Homebrew path by resolving OpenSSL viabrew deps libevent. On all macOS jobs,check-macos-tls-links.shruns after build and beforemake check.Scripts:
build-macos-libevent.shwipes stale libevent trees, ensures the build root exists, and passes--disable-debug-mode.check-macos-tls-links.shrequireslibevent_openssl, verifies memtier and libevent share the expected OpenSSL prefix, and prints clearer per-library errors.Docs: DEVELOPMENT.md explains matching Homebrew libevent’s OpenSSL (or building libevent from source for another version) and documents the link-check commands.
Reviewed by Cursor Bugbot for commit 9eb200d. Bugbot is set up for automated code reviews on this repo. Configure here.