~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zlay

atproto relay in zig · mirror of https://tangled.org/zat.dev/zlay

0
0
115 lines · 6.1 KB Raw History

operator handoff 2026-06-11 — v0.0.3 deployed; two pre-existing bugs surfaced on the way

operator report. v0.0.3 (92c0d15, ReleaseSafe) is in production and healthy. the deploy itself also surfaced two latent bugs — neither introduced by your changes — one of which needs a design decision from you. data below.

1. tier 1 results (preliminary, ~25 min post-deploy)

pre-deploy (b49a95a)post-deploy (v0.0.3)
event rate353 frames/s353 frames/s (same)
postgres2,656 tx/s1,671 tx/s
queries/event~7.5~4.7

−985 tx/s (−37%) at identical load — larger than the ~350/s the host_id cache alone predicted, but the host_id cache was still warming and the window includes restart catch-up, so treat the split between cache/index/CASE as unattributed for now. I'll run the standard 12h pre/post comparison and update.

operator note: I built account_host_id_idx manually (CONCURRENTLY) before deploying — it took 6.5s, 58 MB, indisvalid=t — so your startup exec no-op'd via IF NOT EXISTS. heads-up on that path for other operators: if a CONCURRENTLY build is interrupted, postgres leaves an INVALID index that IF NOT EXISTS will then silently skip forever. worth knowing it can need a manual REINDEX/drop-recreate; whether the code should detect that is your call.

everything else healthy: 2,974 hosts connected, queue_full 0, no storms, chain-break metrics behaving as designed (prev_data 0, since doing its restart-transient decay).

2. bug: deterministic GPF on shutdown (pre-existing, every SIGTERM)

every zlay shutdown — graceful or not — dies with a general protection fault at the same instruction: libc.so.6+0x50f. three for three:

  • 2026-06-10 18:21:02Z — 5f5a33d pod terminating during the rollback
  • 2026-06-11 05:52:02Z — b49a95a pod terminating during this deploy
  • 2026-06-11 06:06:00Z — v0.0.3 pod terminating during a scale-to-zero

it's been invisible because the pod was being killed anyway. it stopped being free today: each GPF wrote a 26–30 GB core (RocksDB mmaps included), two of which filled the node disk to 96%, tripped kubelet DiskPressure, and got zlay + postgres + the monitoring stack evicted mid-deploy. likely related to the known unjoined-thread / Consumer.shutdown loose ends from the leak investigation, but that's a hypothesis — the cores are ground truth.

  • one core specimen kept: /var/crash/core.zlay.1781157122.1040178 on the node (30 GB, from the b49a95a shutdown; binary = ReleaseSafe-b49a95a, still in buildah storage at /opt/zlay if you need symbols)
  • operator mitigations applied: core dumps disabled node-wide (core_pattern=/dev/null) until this is fixed; duplicate cores deleted. tell me when you want dumps re-armed (bounded properly this time — that part is on me).

related smaller thing: during every rolling pod replacement the new pod crash-restarts 2–3× with rocksdb open failed: .../LOCK: Resource temporarily unavailable until the old pod finishes dying (slower now that its exit path GPFs). self-heals, but it's noise on every deploy.

3. bug + decision needed: sequencer has been in a garbage seq space for ≥2 weeks

found while verifying the deploy: relay_seq = 7,161,747,611,67x,xxx,xxx (7.16 quintillion). the value increments correctly by 1 per event — only the base is wrong.

  • hex of observed values: 0x6363a382... — 0x63=CBOR text(3), 0xa3=map(3), 0x82=array(2). at some past unclean kill, scanForLastSeq accepted a record whose seq field was actually CBOR payload bytes, and every restart since has faithfully resumed garbage+1 (resumeLog, event_log.zig:1226).
  • the entire prometheus retention window (since May 28) is in this space — the corruption predates it; the 06-07/08 exit-139 crashloop is a plausible origin but unproven. genesis seq is 1 in the code, so this can only be a recovered value.
  • all 1,709 on-disk event files are in the bogus space (retention aged out everything sane). per-host upstream cursors in postgres are unaffected (max(host.last_seq) is sane) — this is purely the outbound sequencer.
  • consumer blast radius is small: consumers_active is 1–2, live-tail probes don't use cursors, and zlay correctly serves FutureCursor error frames to anyone presenting a stale-bogus cursor after a reset.

I deliberately did not repair this today — restarting in the same (wrong but monotonic) space added no new damage, and the target seq space is your design call. prepared repair, all steps reversible, for whenever you pick a number (or a different approach entirely):

  1. scale to 0; quarantine (mv) the bogus evts-* files; snapshot log_file_refs then clear it
  2. plant one empty evts-<SEQ> file + matching log_file_refs row — resumeLog scans the empty file and resumes at exactly seq_start (verified against the code path: scan.last_seq null → cur_seq = seq_start)
  3. scale up; verify relay_seq and that playback serves from the new space

the deeper question is recovery hardening: scanForLastSeq record validation accepted text bytes as a seq once, and whatever it accepted then it could accept again at the next torn tail. what plausibility looks like (monotonic vs. file's seq_start? bounded delta? record checksums?) is yours to design — I just want restarts after crashes to stop being able to relocate the seq space. note this interacts with fixing bug #2: once shutdowns stop GPFing, torn tails get rare — but crashes will always exist.

4. state + asks

prod right now: v0.0.3, healthy, bogus-but-stable seq space, core dumps off, disk at 83% (the 88 GB of bogus event files will age out via retention, or go away in the seq repair — whichever lands first).

  1. shutdown GPF: root-cause when you can; the core + binary are waiting.
  2. recovery validation: harden scanForLastSeq against garbage seq fields.
  3. seq space: pick the restore target / approach and I'll run the repair in a coordinated window.
  4. tier 2 (status cache, read-then-upsert collapse, durability decision) — still queued behind the 12h tier-1 verification; status-cache-first sounds right to me, with the write-path mapping you described.

— operator