atproto relay implementation in zig zlay.waow.tech
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

switch to Io.Threaded backend, shelve Evented

the Evented (io_uring fiber) backend has been the source of every major
issue since the 0.16 migration: 8 cross-Io crash classes, a ReleaseSafe
GPF from a zig codegen bug, and a persistent ~10-15% coverage degradation
that nobody could trace. the zig team marks Evented as experimental.

Io.Threaded restores thread-per-PDS (~2,800 OS threads instead of ~35
fibers), which was the proven model on 0.15 at 99%+ coverage. the entire
cross-Io problem class vanishes. ReleaseSafe works again. DNS works
natively. the uring networking patch becomes inert.

one-line change: const Backend = Io.Evented → Io.Threaded.
all io.concurrent() call sites, Io.Future, Io.Mutex, Io.Condition are
backend-agnostic through the std.Io abstraction. pool_io becomes
redundant but harmless (both runtimes are now Threaded).

builds clean: zig build test, zig fmt, and
zig build -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseSafe all pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+7 -10
+7 -10
src/main.zig
··· 48 48 pub const default_stack_size = 8 * 1024 * 1024; 49 49 50 50 // -- Io backend selection -- 51 - // Io.Evented (fibers on io_uring): ~35 threads instead of ~2,800 (one per PDS). 52 - // Networking via patched Uring.zig (patches/uring-networking.patch) — implements 53 - // listen, accept, connect, read, write, send via io_uring opcodes. DNS (netLookup) 54 - // is NOT patched; subscribers resolve hostnames through pool_io (Threaded) instead. 51 + // Io.Threaded: one OS thread per io.concurrent() call (~2,800 for PDS subscribers). 52 + // Higher thread count than Evented (~35) but proven stable at 99%+ coverage on 0.15. 55 53 // 56 - // History: 28 commits of cross-Io fixes (see docs/evented-attempt.md). The 57 - // production SIGSEGV that prompted a brief Threaded revert turned out to be a 58 - // websocket handshake bug (TCP split mid-CRLF), not a fiber issue. Fixed in 59 - // websocket.zig 9ac64da. Evented + ReleaseSafe GPFs immediately on startup 60 - // (same as repro) — must build with ReleaseFast. 61 - const Backend = Io.Evented; 54 + // Evented (io_uring fibers) shelved: 8 crash classes from cross-Io violations, 55 + // ReleaseSafe GPF from fiber context-switch codegen bug, persistent ~10-15% coverage 56 + // degradation, zig team marks Evented as experimental. See docs/evented-attempt.md. 57 + // Can revisit when zig's Evented runtime matures. 58 + const Backend = Io.Threaded; 62 59 63 60 var backend: Backend = undefined; 64 61 var debug_threaded_io: Io.Threaded = undefined;