gotchas
hard-won knowledge from debugging zlay. check here before guessing.
zig 0.15
&.{...}in loops creates stack-local arrays that alias across iterations — all references point to same memory. heap-allocate instead.- operator precedence:
(byte & 0xf0) == 0notbyte & 0xf0 == 0 ArrayListis unmanaged — pass allocator to each methodf.readAll()notf.reader().readAll()—File.reader()takes a buffer arg in zig 0.15
pg.zig
pool.rowUnsafe()for single-row queries —.get(T, col)returnsTpool.query()+result.nextUnsafe()for multi-rowQueryRow.deinit()returns!void— usedefer row.deinit() catch {}- DB-dependent tests skip via
requireDatabaseUrl()→error.SkipZigTest
websocket.zig fork
fork of karlseguin/websocket.zig, canonical at tangled.org:zzstoatzz.io/websocket.zig (pinned v0.1.8), with patches:
httpFallback:_handleHandshakecatches parse errors, routes toH.httpFallbackif present — this is how all HTTP API endpoints are served on the WS port- lenient handshake parser: non-WS headers skip instead of error
metrics
- mallinfo() overflows at 2 GiB (c_int fields) — smaps metrics are the reliable RSS source
relay_build_info{git_sha,optimize}confirms what binary is running
deploy
- containers are minimal debian — no curl, wget, or shell utilities. use busybox pod or
kubectl port-forward - two separate kubeconfigs: Go relay (
kubeconfig.yaml) vs zlay (zlay-kubeconfig.yaml) $ZLAY_KUBECONFIGis only set insidejust— raw shell needs the absolute path- after
helm upgrade, mustkubectl set imageback to SHA tag (helm useslatestfrom values) - never change probe paths and image in separate operations (see incident-2026-03-04.md)