Skip to content

fix(srv6): broadcast gateway SID events off the GatewayManager lock#28

Merged
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-gateway-lock-scope
Jul 3, 2026
Merged

fix(srv6): broadcast gateway SID events off the GatewayManager lock#28
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-gateway-lock-scope

Conversation

@ryskn

@ryskn ryskn commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

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.

Fix

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.

Review finding

Low (concurrency) C3.

Test

go test ./calico-vpp-agent/srv6egress/... + GOOS=linux go vet green.

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.
@ryskn ryskn merged commit dbfeadd into dev/srv6egress-v1 Jul 3, 2026
1 check passed
@ryskn ryskn deleted the fix/srv6-gateway-lock-scope branch July 3, 2026 01:37
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