From 93c09b99ae6b00a81bc7487b438bdc8e6f1135c6 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Fri, 2 Oct 2026 22:19:14 -0700 Subject: [PATCH] main: detach archive hooks before the steady-state frame returns; fix docker dep fetch the 0.17 port moved the compactor and consumer into runSteadyState's frame while the archive, which holds on_append/on_durable pointers to them, lives in serve. nothing appends or flushes after that frame returns today, but the pointers would dangle; clear them on exit, after the fallback close has flushed. Dockerfile: `zig build --fetch-only` was never a flag. 0.16 fetched dependencies before rejecting it, so the cache layer worked by accident; 0.17 rejects it first and `|| true` hid that. use `--fetch`, and let a failed fetch fail the build. Co-Authored-By: Claude Opus 5.5 (1M context) --- Dockerfile | 2 +- src/main.zig | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 336b049..bad4108 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /build # fetch dependencies first (cacheable — only changes with build.zig.zon) COPY build.zig build.zig.zon ./ -RUN zig build --fetch-only 2>/dev/null || true +RUN zig build --fetch COPY .git/ .git/ COPY src/ src/ diff --git a/src/main.zig b/src/main.zig index 06d5d60..f916424 100644 --- a/src/main.zig +++ b/src/main.zig @@ -918,6 +918,11 @@ fn runSteadyState( compactor.rewrite_workers = cfg.compaction_rewrite_workers; compactor.stats = stats; compactor.trace_context = steady_trace.context(); + // The archive outlives this frame; its hooks must not. + defer { + archive.on_append = null; + archive.on_append_ctx = null; + } if (cfg.compaction_interval_ns != 0) { try compactor.rebuild(); archive.on_append_ctx = &compactor; @@ -992,6 +997,10 @@ fn runSteadyState( .slow_upstream = .{ .min_rate = cfg.upstream_slow_min_rate }, }; defer consumer.deinit(); + defer { + archive.on_durable = null; + archive.on_durable_ctx = null; + } // The archive's durability hook points into consumer. Keep the fallback // close above consumer's deinit in the unwind stack so every error path // flushes while the callback context is still alive. -- 2.51.2