You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(lavasession): add mutex to Endpoint to prevent race conditions
Add a sync.RWMutex to the Endpoint struct to protect concurrent access
to Connections, ConnectionRefusals, and Enabled fields. This fixes a
pre-existing race condition that occurred when multiple goroutines
(from probeProviders) accessed the same Endpoint object simultaneously.
The race was detected in fetchEndpointConnectionFromConsumerSessionWithProvider
where multiple providers could share the same Endpoint object and
concurrently modify its fields without synchronization.
The fix:
- Added `mu sync.RWMutex` field to Endpoint struct
- Wrapped modifications to Connections, ConnectionRefusals, and Enabled
with Lock/Unlock
- Used RLock/RUnlock for read-only access to Enabled field
- Carefully release lock before blocking network calls and re-acquire after
0 commit comments