Fix #5: bound + dedupe argon2id verifications (OOM under Finder WebDAV storms), hardening #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-5-oom-argon2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Diagnosis (evidence from the live pod, 2026-07-20)
lastState.terminated: OOMKilled, exit 137, restartCount 6; pod lived ~3m per life, dying right at Finder mount timeRoot cause: each argon2id verification allocates the full 64 MiB memory parameter (RFC 9106 defaults).
Local.Authenticatehad no concurrency bound, and Finder's mount opens many parallel connections all presenting the same Basic credentials before the SHA-256 verified cache is warm → N × 64 MiB simultaneous allocations vs the 256Mi cgroup limit → OOM. The limits ink3s/cairn/deployment.yamlwere already at the suggested 64Mi/256Mi, so a limit bump alone would not have fixed it. The dummy-hash anti-enumeration path had the same problem, making unauthenticated request storms a remote OOM vector too.Fix (stdlib-only, no new dependencies)
internal/auth: inflight-dedupe of identical concurrent (username, sha256(password)) verifications — the Finder storm collapses to one argon2 run — plus a process-wide semaphore capping distinct concurrent runs at 2 (~128 MiB worst case, safely inside 256Mi). Unknown-username requests take the same bounded path.Hardening (fix-first doc Step 3)
cmd/cairnd:IdleTimeout: 120s(Finder holds many idle keep-alives). Deliberately no ReadTimeout/WriteTimeout — whole-request deadlines would kill large WebDAV transfers.internal/obs:Recovermiddleware, mounted outermost — handler panics now log method/path/stack via slog and answer 500 instead of a stderr-only trace. Re-panicshttp.ErrAbortHandler.internal/dav: first test batch for the package — Finder request shapes: PROPFIND variants (allprop/named/empty bodies, missing + infinity Depth), LOCK/UNLOCK sequence, zero-byte AppleDouble._*PUTs, Range GET, 32-way parallel PROPFIND, MOVE/COPY Overwrite semantics.No manifest change needed
With argon2 memory bounded, the existing 64Mi request / 256Mi limit is comfortable.
After merge (manual, per manual-guide)
Rebuild + push multi-arch image as
v0.0.2(buildx with the buildkitd.toml registry config), bump the tag ink3s/cairn/deployment.yamlvia homelab-config, then rerun the Step 4 interop tests withkubectl get pods -n cairn -win a second terminal.Closes #5 (pending retest).