fix(srv6): broadcast gateway SID events off the GatewayManager lock#28
Merged
Conversation
reconcileLocked / teardownLocked called AdvertiseSID / WithdrawSID while holding m.mu, and those do a blocking pub/sub broadcast (SendEvent sends on each consumer's channel). A backed-up consumer therefore stalled every other EgressPolicy gateway operation. Collect the SID advertise/withdraw closures under the lock and run them from flushPendingSID after the lock is released (deferred LIFO so it runs after Unlock, preserving panic safety). Order and synchronous-from-caller semantics are unchanged, so existing tests still hold.
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.
What
reconcileLocked/teardownLockedcalledAdvertiseSID/WithdrawSIDwhile holdingm.mu, and those do a blocking pub/sub broadcast (SendEventsends on each consumer's channel). A backed-up consumer therefore stalled every other EgressPolicy gateway operation.Fix
Collect the SID advertise/withdraw closures under the lock and run them from
flushPendingSIDafter the lock is released (deferred LIFO so it runs afterUnlock, preserving panic safety). Order and synchronous-from-caller semantics are unchanged.Review finding
Low (concurrency) C3.
Test
go test ./calico-vpp-agent/srv6egress/...+GOOS=linux go vetgreen.