Skip to content

fix(srv6): synchronize pub/sub handler registrations#31

Merged
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-pubsub-registration-race
Jul 3, 2026
Merged

fix(srv6): synchronize pub/sub handler registrations#31
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-pubsub-registration-race

Conversation

@ryskn

@ryskn ryskn commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

RegisterHandler appends to pubSubHandlerRegistrations and SendEvent ranges it with no lock. The srv6egress SR-policy-liveness handler is registered after the route/prefix/peer/routing producers have started calling SendEvent, so the concurrent append+range is a data race that can drop the registration (steering liveness silently never wired).

Fix

Guard the slice with an RWMutex. SendEvent snapshots under the read lock and sends off-lock, so a slow consumer can't stall a concurrent RegisterHandler.

Review finding

Low (concurrency) C2.

Test

GOOS=linux go vet ./calico-vpp-agent/common/... green.

RegisterHandler appends to pubSubHandlerRegistrations and SendEvent ranges
it with no lock. The srv6egress SR-policy-liveness handler is registered
after the route/prefix/peer/routing producers have started calling
SendEvent, so the concurrent append+range is a data race that can drop
the registration. Guard the slice with an RWMutex; SendEvent snapshots
under the read lock and sends off-lock so a slow consumer can't stall a
concurrent RegisterHandler.
@ryskn ryskn merged commit 0c13678 into dev/srv6egress-v1 Jul 3, 2026
1 check passed
@ryskn ryskn deleted the fix/srv6-pubsub-registration-race branch July 3, 2026 01:43
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