Skip to content

trafficserver10: init at 10.2.1 - #474177

Merged
drupol merged 1 commit into
NixOS:masterfrom
randomizedcoder:trafficserver10
Nov 27, 2026
Merged

drupol merged 1 commit into
NixOS:masterfrom
randomizedcoder:trafficserver10

Conversation

@randomizedcoder

@randomizedcoder randomizedcoder commented Dec 25, 2025 •

Copy link
Copy Markdown
Contributor

Add Apache Traffic Server 10.x as trafficserver10, the current major version of the HTTP caching proxy.

Update — now on 10.2.1

  • Bumped to 10.2.1, a security maintenance release (CVE-2025-55702 and further fixes since 10.2.0). 10.2.x links only PCRE2.
  • 10.2.1 includes the libatomic CAS fallback (Use __atomic builtins as the freelist 128-bit CAS fallback apache/trafficserver#13571), so that backport is dropped; one small riscv64 patch remains.
  • Review feedback: lib.optionals, versionCheckHook (meta.mainProgram = "traffic_server"), and the traffic_via check moved to passthru.tests.traffic-via.
  • aarch64-darwin now builds: cjose is enabled on glibc only (see Platform support).
  • Re-tested natively on x86_64-linux, aarch64-linux (Raspberry Pi 5) and aarch64-darwin (Apple M5). riscv64 cross-compiles; a native build on the BPI-F3 is running.

It is a separate package from the existing trafficserver (v9.x), because v10 has breaking changes:

Aspect v9 (trafficserver) v10 (trafficserver10)
Build system autotools CMake + Ninja
PCRE PCRE1 PCRE2 only
tspush utility Present Removed
Default configs $out/etc/ $out/share/trafficserver/

The existing NixOS module (services.trafficserver) is unchanged and still uses pkgs.trafficserver (v9). Wiring v10 into the module is left for a follow-up.

Features enabled by default

All optional features except MaxmindDB are enabled. Upstream's CMake auto-detects them from buildInputs:

  • Brotli: compression (compress.so)
  • LuaJIT: Lua scripting (tslua.so). Gated on lib.meta.availableOn, so it is off on platforms without LuaJIT (e.g. riscv64)
  • Hiredis: Redis support
  • ImageMagick: image transforms (webp_transform.so)
  • Jansson: JSON handling
  • KyotoCabinet: key-value storage
  • Cjose: URI signing / JWT (uri_signing.so). glibc only: the plugin needs hsearch_r and re_compile_pattern
  • WCCP: Web Cache Communication Protocol

MaxmindDB (GeoIP) is off by default because it needs separate database files. All of these can be toggled with .override:

trafficserver10.override {
  withMaxmindDB = true;
  withBrotli = false;
}

Package structure

$out/
├── bin/                      # traffic_server, traffic_ctl, traffic_top, etc.
├── lib/                      # shared libraries
├── libexec/                  # plugins (.so)
├── include/                  # development headers
└── share/trafficserver/      # default config files

Default configs are moved from etc/ to share/trafficserver/ because the store is read-only; a module copies them to /etc/trafficserver/.

Platform support

Each native platform was tested with a reverse-proxy smoke test: ATS proxied a local origin, served the second fetch as a fresh RAM cache hit (Via [cRs f ]), then answered 8 concurrent clients × 500 requests, all 200, without further origin fetches.

Arch Result How
x86_64-linux ✅ builds, version check and passthru.tests pass, proxies and caches traffic native
aarch64-linux ✅ builds, version check and passthru.tests pass, proxies and caches traffic native on real hardware (Raspberry Pi 5, Cortex-A76)
aarch64-darwin ✅ builds, version check and passthru.tests pass, proxies and caches traffic native (Apple M5 Pro)
riscv64-linux ✅ cross-compiles (pkgsCross.riscv64.trafficserver10, all 64 plugins); ⏳ native build on a Banana Pi BPI-F3 (SpacemiT K1) in progress 10.2.0 with the equivalent riscv64 patches was built natively and smoke-tested on the BPI-F3

riscv64: src/iocore/eventsystem/UnixEventProcessor.cc has a hard-coded list of architectures whose stack grows down, and errors on anything else. riscv-stack-growth-direction.patch adds __riscv, whose stack also grows down. It is not fixed upstream yet. The freelist's 128-bit CAS falls back to libatomic on riscv64 since 10.2.1 (apache/trafficserver#13571); x86_64 and aarch64 keep the inline CAS.

Darwin: the uri_signing plugin uses glibc's hsearch_r and re_compile_pattern, so it fails to build on Darwin. cjose is only used by that plugin, so withCjose defaults to stdenv.hostPlatform.libc == "glibc".

Build verification

$ ldd result/bin/traffic_server | grep -i pcre
libpcre2-8.so.0 => .../lib/libpcre2-8.so.0

$ ldd result/libexec/tslua.so | grep lua
libluajit-5.1.so.2 => .../lib/libluajit-5.1.so.2

$ ldd result/libexec/compress.so | grep brotli
libbrotlienc.so.1 => .../lib/libbrotlienc.so.1

Things done

  • Built on platform:

    • x86_64-linux

    • aarch64-linux

    • x86_64-darwin

    • aarch64-darwin

  • Tested, as applicable:

    • [NixOS tests] in [nixos/tests].

    • [Package tests] at passthru.tests.

    • Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.

  • Ran nixpkgs-review on this PR. See [nixpkgs-review usage].

  • Tested basic functionality of all binary files, usually in ./result/bin/.

    • traffic_server --version (versionCheckHook) ✓ (x86_64-linux, aarch64-linux, aarch64-darwin)
    • traffic_via header parsing (passthru.tests.traffic-via) ✓ (same)
    • reverse-proxy + cache smoke test ✓ (x86_64-linux, aarch64-linux on a Pi 5, aarch64-darwin on an M5)
  • Nixpkgs Release Notes

    • Package update: when the change is major or breaking.
  • NixOS Release Notes

    • Module addition: when adding a new NixOS module.

    • Module update: when the change is significant.

  • Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.

Links

🤖 Generated with Claude Code

@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/6202

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Dec 25, 2025
@Sigmanificient

Copy link
Copy Markdown
Member

Might be related:

@randomizedcoder

Copy link
Copy Markdown
Contributor Author

@Sigmanificient I'm sorry, but I'm not really following the PCRE1 stuff. I suspect there are many packages using PCRE1. - This won't block this PR, correct?

@raboof raboof mentioned this pull request Jan 13, 2026
13 tasks
@nixpkgs-ci nixpkgs-ci Bot added the 8.has: package (new) This PR adds a new package label Jan 27, 2026
@infinisil

Copy link
Copy Markdown
Member

Closing and reopening to fix CI, see #499751

@randomizedcoder

Copy link
Copy Markdown
Contributor Author

Rebased onto current master, squashed into a single commit, and addressed nix-idiomatic issues:

  • Switched from rec to finalAttrs pattern
  • Fixed pname to "trafficserver10" to match by-name directory
  • Removed redundant outputs = [ "out" ]
  • Removed verbose header comments (not idiomatic for nixpkgs)
  • Verified 10.1.1 is still the latest upstream release
  • Passes nixfmt --check and nix-instantiate --parse

@wishstudio

wishstudio commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Upstream has already purged PCRE completely: apache/trafficserver@b38147f
But cheking the commit history it seems it will only land in the next major release.
Given we still package trafficserver-9 which depends on PCRE I feel it is OK to introduce the dependency atm as this is effectively an update rather than a new package. The PCRE dependency will go away in the foreseeable future as the package is actively developed. In the worse case we can bump to master branch later.

@fliiiix

fliiiix commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@randomizedcoder randomizedcoder changed the title trafficserver10: init at 10.1.0 trafficserver10: init at 10.2.0-rc1 Aug 15, 2026
@randomizedcoder

Copy link
Copy Markdown
Contributor Author

@fliiiix good question — I checked the sources: 10.1.4 still requires PCRE1 (find_package(PCRE REQUIRED) + cmake/FindPCRE.cmake are still there alongside PCRE2). PCRE1 is only purged in the 10.2.x line (no FindPCRE.cmake; only pkg_check_modules(PCRE2 REQUIRED IMPORTED_TARGET libpcre2-8) remains). There's no stable 10.2.0 yet — only 10.2.0-rc0/-rc1.

So I've prepared this PR against 10.2.0-rc1 to be PCRE1-free and make the eventual bump trivial — not expecting it to merge as an RC. The plan is to re-pin to stable 10.2.0 with a quick version + hash update once it's released, and merge then. ldd result/bin/traffic_server confirms it now links only libpcre2-8.so.0, no libpcre.so.1.

@randomizedcoder

randomizedcoder commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Did some extra multi-architecture testing on real hardware and via cross-compilation, and tightened the platform metadata as a result:

aarch64-linux — built and run natively. Compiled trafficserver10 natively on a Raspberry Pi 5 (Cortex-A76) and ran the traffic_via installCheck on-device. Links only libpcre2-8, no PCRE1. I've ticked the aarch64-linux box.

riscv64 — unsupported upstream, now excluded via meta.badPlatforms. I tried both a native build (SpacemiT K1) and a cross-compile (pkgsCross.riscv64.trafficserver10). Both fail identically at:

include/tscore/ink_queue.h:177:2: error: #error "unsupported processor"

Traffic Server's lock-free freelist needs an ABA-safe atomic head and picks one of two strategies: a generic path when the toolchain has a lock-free 128-bit compare-and-swap (TS_HAS_128BIT_CAS), otherwise an arch-specific pointer-tagging layout (freelist version packed into the unused high bits of a 64-bit pointer) that upstream hand-codes only for x86_64 (48-bit VA) and aarch64 (52-bit VA). riscv64 has neither — no lock-free 128-bit CAS (so TS_HAS_128BIT_CAS is off; the compile reaches the #else) and no riscv tagging case — so it hits the #error. (v9 carries the same freelist code, so it would fail identically on riscv64 — I didn't build it to confirm.) Since this is upstream rather than a packaging issue, I added:

badPlatforms = lib.platforms.riscv;

so the package advertises the restriction instead of failing to build on RISC-V.

Cross-compile correctness. The cross attempt also exposed that doInstallCheck = true would force the traffic_via installCheck to run a foreign binary (needing binfmt/qemu) on cross builds. Fixed by gating it:

doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

Native builds are unaffected (the check still runs); cross builds now skip it cleanly.

x86_64-linux + native aarch64-linux both build green with only PCRE2 linked. Description updated with the details.

@randomizedcoder

Copy link
Copy Markdown
Contributor Author

For the record: I filed a friendly heads-up upstream about the riscv64 build failure, since it's an upstream limitation rather than a packaging issue — apache/trafficserver#13555.

It documents the ink_queue.h #error "unsupported processor" (no lock-free 128-bit CAS on riscv64 + no riscv pointer-tagging case) and offers to test any patch on real RISC-V hardware. Nothing needed on the Nixpkgs side — the package already declares badPlatforms = lib.platforms.riscv; if/when upstream adds RISC-V support we can just drop that line.

@nixpkgs-ci nixpkgs-ci Bot added the 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! label Sep 23, 2026

stdenv.mkDerivation (finalAttrs: {
pname = "trafficserver10";
version = "10.2.0-rc1";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nixpkgs-ci nixpkgs-ci Bot added llm-assisted Contributions that include code generation with LLMs and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Oct 12, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 14, 2026
@randomizedcoder randomizedcoder changed the title trafficserver10: init at 10.2.0-rc1 trafficserver10: init at 10.2.0 Oct 14, 2026
@randomizedcoder

Copy link
Copy Markdown
Contributor Author

This is now ready for review. Sorry it has been open so long; it was waiting on a stable PCRE2-only release.

@fliiiix thanks, good catch: it's now on the stable 10.2.0 tag (the rc1 commit promoted unchanged, so the source hash didn't change).

Since the last push:

  • Rebased onto current master and squashed to a single commit.
  • riscv64 now builds, with two small patches: the upstream libatomic CAS fallback (Use __atomic builtins as the freelist 128-bit CAS fallback apache/trafficserver#13571, already on the 10.2.x branch) and a one-line stack-growth-direction fix. meta.badPlatforms is gone.
  • Tested on real hardware: x86_64, aarch64 natively on a Raspberry Pi 5, and riscv64 on a Banana Pi BPI-F3. On each, ATS reverse-proxied traffic and served cache hits under 8 concurrent clients. Details are in the updated description.
  • nixpkgs-review passes on x86_64.

@midchildan, as maintainer of the v9 trafficserver package, would you be willing to take a look?

🤖 Generated with Claude Code

@domenkozar

Copy link
Copy Markdown
Member

@drupol would love to see this merged

@drupol drupol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Made a few comments, let me know if they make sense to you.

Also, would it be possible to add a versionCheckHook if the CLi supports it ?

pname = "trafficserver10";
version = "10.2.0";

# 10.2.x drops the legacy PCRE1 dependency and links only PCRE2.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment doesn't really make sense here. Or am I missing something ?

Comment on lines +89 to +101
++ lib.optional withBrotli brotli
++ lib.optional withCap libcap
++ lib.optional withCjose cjose
++ lib.optional withCurl curl
++ lib.optional withHiredis hiredis
++ lib.optional withHwloc hwloc
++ lib.optional withImageMagick imagemagick
++ lib.optional withJansson jansson
++ lib.optional withKyotoCabinet kyotocabinet
++ lib.optional withCurses ncurses
++ lib.optional withLuaJIT luajit
++ lib.optional withUnwind libunwind
++ lib.optional withMaxmindDB libmaxminddb;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer to continue using lib.optionals here.

Suggested change
++ lib.optional withBrotli brotli
++ lib.optional withCap libcap
++ lib.optional withCjose cjose
++ lib.optional withCurl curl
++ lib.optional withHiredis hiredis
++ lib.optional withHwloc hwloc
++ lib.optional withImageMagick imagemagick
++ lib.optional withJansson jansson
++ lib.optional withKyotoCabinet kyotocabinet
++ lib.optional withCurses ncurses
++ lib.optional withLuaJIT luajit
++ lib.optional withUnwind libunwind
++ lib.optional withMaxmindDB libmaxminddb;
++ lib.optionals withBrotli [ brotli ]
++ lib.optionals withCap [ libcap ]
++ lib.optionals withCjose [ cjose ]
++ lib.optionals withCurl [ curl ]
++ lib.optionals withHiredis [ hiredis ]
++ lib.optionals withHwloc [ hwloc ]
++ lib.optionals withImageMagick [ imagemagick ]
++ lib.optionals withJansson [ jansson ]
++ lib.optionals withKyotoCabinet [ kyotocabinet ]
++ lib.optionals withCurses [ ncurses ]
++ lib.optionals withLuaJIT [ luajit ]
++ lib.optionals withUnwind [ libunwind ]
++ lib.optionals withMaxmindDB [ libmaxminddb ];

Comment on lines +129 to +139
installCheckPhase = ''
runHook preInstallCheck

# Verify traffic_via parses Via headers correctly
output=$($out/bin/traffic_via '[uScMsEf p eC:t cCMp sF]')
echo "$output" | grep -q "Via header is"
echo "$output" | grep -q "Length is 22"
echo "$output" | grep -q "cache miss"

runHook postInstallCheck
'';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opinionated: I don't think we should test this in here, but perhaps in a test ? (passthru.smoke-test = runCommand ... ?)

Apache Traffic Server 10.x, the CMake-based successor to the 9.x line
packaged as trafficserver. 10.2 links only PCRE2.

Add __riscv to the stack-growth-direction allowlist in
UnixEventProcessor.cc so riscv64 builds; 10.2.1 already includes the
libatomic 128-bit CAS fallback (apache/trafficserver#13571).

cjose is only enabled on glibc: its sole user, the uri_signing plugin,
needs hsearch_r and re_compile_pattern, so it fails to build on Darwin.

Assisted-by: Claude Code (Claude Opus 5.5)
@randomizedcoder randomizedcoder changed the title trafficserver10: init at 10.2.0 trafficserver10: init at 10.2.1 Nov 26, 2026
@randomizedcoder

Copy link
Copy Markdown
Contributor Author

@drupol thanks, all addressed:

  • Dropped the PCRE1 comment and switched to lib.optionals … [ … ].
  • Moved the traffic_via check to passthru.tests.traffic-via, and added versionCheckHook (traffic_server --version, now meta.mainProgram).
  • Bumped to 10.2.1, a security release (CVE-2025-55702 and further fixes since 10.2.0). It includes the libatomic CAS fallback, so that backport is gone; the riscv stack-growth patch is still needed.
  • aarch64-darwin didn't build: the uri_signing plugin (cjose's only user) needs glibc's hsearch_r/re_compile_pattern, so withCjose now defaults to glibc only.

Built natively on x86_64-linux, aarch64-linux (Pi 5) and aarch64-darwin (M5); on each, the version check and passthru test pass, and ATS reverse-proxies with cache hits under 8 concurrent clients. riscv64 cross-compiles; a native build on the BPI-F3 is running and should finish by tomorrow, and I'll follow up then.

@drupol
drupol added this pull request to the merge queue Nov 27, 2026
Merged via the queue into NixOS:master with commit 26ffdfe Nov 27, 2026
28 checks passed
@randomizedcoder

Copy link
Copy Markdown
Contributor Author

Thanks for merging. Follow-up on riscv64: the cross-built 10.2.1 (pkgsCross.riscv64.trafficserver10, all 64 plugins) passes on the BPI-F3: traffic_server --version, the traffic_via check, and the same reverse-proxy smoke test (fresh cache hit, 8 × 500 requests all 200). I didn't finish a native riscv64 build of 10.2.1, because bootstrapping gcc ran out of memory on the 8 GB board.

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

Labels

7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants