Skip to content

docs: agent concurrency audit — 8 findings (snapshot races, pod lifecycle, supervisor hardening) - #108

Merged
bpalermo merged 1 commit into
mainfrom
docs/concurrency-audit
Jun 10, 2026
Merged

bpalermo merged 1 commit into
mainfrom
docs/concurrency-audit

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

Code-inspection concurrency audit of the agent, done after the extended hot-restart e2e (12,000/12,000 mesh requests, zero drops, across two surge rolls + one in-place ConfigMap restart; all nodes ended LIVE epoch 8 / generation 9). None of these fired during the e2e — all are inferred from code reading. Findings doc: docs/proposals/002_agent-concurrency-audit.md.

# Severity Finding
R1 HIGH generateSnapshot lost-update: concurrent callers can publish a stale snapshot after a newer one (version order ≠ content order) — dropped listener removals / missing rotated SVIDs until the next trigger. Fix: serialize version+read+SetSnapshot under one mutex.
R2 HIGH (data race) RemoveEndpoint mutates loadAssignment in place while the same proto is aliased into live snapshots being marshaled — torn reads, -race violation. Fix: rebuild/clone.
R3 MEDIUM LoadListenersFromStorage wholesale-replaces localWorkloads, wiping a concurrently added pod's netns→SPIFFE mapping (startup window) → pod presents node cert instead of its SVID. Fix: merge.
R4 MEDIUM Liveness loop can re-register a deleted pod's endpoint between RemovePod's unregister and storage removal → permanent ghost endpoint in the registry. Fix: storage-remove first.
R5 LOW Bridge.client/ctx read/written unsynchronized; Started() already provides the happens-before — use it.
R6 LOW SVID resubscribe can race CNI DEL → leaked forever-subscription. Fix: re-check storage after subscribe.
R7 LOW Rapid hot-restart triggers while an epoch is initializing kill the proxy pod. Fix: gate hotRestart() on current epoch LIVE.
R8 LOW Epoch state-file read-check-write can briefly regress during surge overlap (needs triple pod overlap). Optional lockfile.

Also documents the paths checked and found sound (supervisor channel discipline, refresher debounce, unsubscribe refcounting, etc.).

No code changes — findings only, with a suggested order of work (R1+R2 first, one small PR).

🤖 Generated with Claude Code

…ifecycle)

Eight findings from a code-inspection audit after the 12k-request zero-drop
multi-restart e2e: snapshot lost-update race (R1) and aliased proto mutation
(R2) as the high-severity items, plus pod-lifecycle and supervisor hardening
notes. No fixes applied; suggested order of work included.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@bpalermo
bpalermo merged commit 57056ec into main Jun 10, 2026
9 of 10 checks passed
@bpalermo
bpalermo deleted the docs/concurrency-audit branch June 10, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant