From 74942c144587e630f7abe7c0974bf7dcd9a39366 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Wed, 19 Aug 2026 01:25:44 -0500 Subject: [PATCH] metrics: actually emit zio_sched_events_rearmed_total 3524e04 added the counter to the args tuple but never added its line to the format string, leaving 15 args against 14 placeholders. Extra args are a hard compile error in 0.16, so the production build did not build at all -- and the metric the incident follow-up asks operators to watch was not emitted. The default suite could not catch it: build.zig defaults to -Dbackend=threaded and the whole block is behind `if (comptime backend_config.use_zio)`, so it is never semantically analyzed. `zig build test` stayed green while ReleaseSafe-zio, which is what production runs, could not compile. CLAUDE.md now requires `zig build -Dbackend=zio` before pushing. Verified: zig fmt --check, zig build test, zig build test -Dbackend=zio, and zig build -Dbackend=zio -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseSafe. Co-Authored-By: Claude Opus 5 (1M context) --- CLAUDE.md | 6 ++++++ src/main.zig | 3 +++ 2 files changed, 9 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index a4e8539..eab2950 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,6 +8,12 @@ production. see docs/design.md for the threading and backend model. ## before pushing - `zig fmt --check .` and `zig build test` +- **also `zig build -Dbackend=zio`** — the default backend is `threaded`, so every + `if (comptime backend_config.use_zio)` block is never semantically analyzed by the + default suite. zio-only code can fail to compile while `zig build test` is green, + and production is zio. (this shipped a broken build on 2026-08-19: a `/metrics` + format string with one fewer placeholder than args — a hard error in 0.16 — passed + the default suite untouched.) - production is `-Dtarget=x86_64-linux-gnu` (glibc malloc's per-thread arenas + page-return are load-bearing for RSS under the Threaded fallback's ~2,800 threads). the "musl breaks RocksDB" belief is **retired** — musl builds and runs SIGILL-free on 0.16 — but mimalloc (the only static-musl allocator we found viable) leaks under our thread model, so prod stays glibc. see [docs/musl-investigation.md](docs/musl-investigation.md) - ReleaseFast has a known double-free — do not use - under zio a fiber that never yields owns the scheduler — no busy loops, no sub-ms sleep spins diff --git a/src/main.zig b/src/main.zig index efba0a6..546cbe2 100644 --- a/src/main.zig +++ b/src/main.zig @@ -186,6 +186,9 @@ const MetricsServer = struct { \\# HELP zio_sched_free_fibers recycled fiber structs \\# TYPE zio_sched_free_fibers gauge \\zio_sched_free_fibers {d} + \\# HELP zio_sched_events_rearmed_total readiness delivered for a fiber that was not parked. poller delivery destroys the arm, so before the re-arm each of these was a permanently lost wake — a connection deaf until restart (2026-08-18). a climbing rate names the trigger. + \\# TYPE zio_sched_events_rearmed_total counter + \\zio_sched_events_rearmed_total {d} \\# HELP zio_poller_registrations fds with an armed direction (collapse = erosion) \\# TYPE zio_poller_registrations gauge \\zio_poller_registrations {d} -- 2.51.2