Repository navigation
fix(agent): remaining concurrency-audit findings (R2, R4–R8) - #110
Merged
Merged
Conversation
From docs/proposals/002: R2: RemoveEndpoint builds a NEW load assignment instead of mutating the proto aliased into snapshots already set on go-control-plane (data race with xDS marshaling goroutines). R4: a lifecycleMu serializes RemovePod's unregister+storage-delete against the liveness loop's health re-registrations, and liveness re-checks storage under the lock before registering — closing the window where a deleted pod's endpoint was resurrected in the registry permanently. R5: SubscribePod/UnsubscribePod gate on the started channel instead of a bare b.client nil-check; close(started) happens-after the client/ctx assignments, so the gate also synchronizes their reads. R6: the SVID resubscriber re-checks storage after subscribing and unsubscribes if the pod's CNI DEL ran in between (the subscription would otherwise leak for the agent's lifetime). R7: the supervisor defers a hot-restart trigger while the current epoch is not yet admin-LIVE (forking N+1 against an initializing N exits Envoy fatally and restarts the container); the debounce re-arms until LIVE. R8: best-effort flock around the epoch state-file read-check-write so a draining pod's heartbeat and a successor's first write cannot interleave into a brief epoch regression. Regression tests for R2/R4/R5/R7; all affected packages pass with -race. Co-Authored-By: Claude Opus 4.8 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Jun 10, 2026
…#120) - docs/workload-requirements.md: how a workload joins the mesh (SA-derived service name, managed label, annotations), the outbound listener calling convention, the two workload-side settings required for hitless rolls (minReadySeconds, native preStop sleep) with the validated termination sequence, and the exact retry semantics clients get for free. - 002 audit doc: status header was stale ("no fixes applied"); all findings landed in #109/#110/#111. Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the rest of the concurrency audit (
docs/proposals/002, #108); complements #109 (R1+R3).RemoveEndpointnow builds a new load assignment instead of mutating the proto aliased into already-set snapshots (xDS goroutines marshal those withoutclusterMu).LocalityLbEndpointsvalues are immutable post-creation, so sharing them across assignments is safe.lifecycleMuserializesRemovePod(unregister → storage delete) against the liveness loop, which now re-checks storage under the lock before re-registering — a deleted pod's endpoint can no longer be resurrected in the registry.SubscribePod/UnsubscribePodgate on thestartedchannel (whose close happens-after theclient/ctxassignments) instead of a racy nil-check.flockaround the epoch state-file read-check-write (brief epoch regression during surge overlap).Tests
TestRemoveEndpointDoesNotMutateAliasedLoadAssignment(R2)TestReconcileLivenessSkipsRemovedPod— both the removed-pod skip and the healthy→unhealthy re-register path (R4)TestSubscribePodNoopBeforeStart(R5)TestHotRestartDeferredWhileEpochNotLive(R7)--@rules_go//go/config:race✅Note
R7 touches the supervisor's restart path; recommend the usual talos re-pin + a surge-roll sanity check after merge (happy to run it).
🤖 Generated with Claude Code