Skip to content

Fix race condition in loadSession with shared session cache#386

Open
thesinakamali wants to merge 1 commit intorefraction-networking:masterfrom
thesinakamali:fix/session-cache-race-condition
Open

Fix race condition in loadSession with shared session cache#386
thesinakamali wants to merge 1 commit intorefraction-networking:masterfrom
thesinakamali:fix/session-cache-race-condition

Conversation

@thesinakamali
Copy link

When multiple goroutines share a ClientSessionCache, loadSession() returns a *SessionState pointer that is shared across connections. Subsequent code (e.g. SessionTicketExtension.InitializeByUtls) mutates this session object, causing a data race. Fix by making a shallow copy of the SessionState immediately after retrieving it from the cache.

When multiple goroutines share a ClientSessionCache, loadSession()
returns a *SessionState pointer that is shared across connections.
Subsequent code (e.g. SessionTicketExtension.InitializeByUtls) mutates
this session object, causing a data race. Fix by making a shallow copy
of the SessionState immediately after retrieving it from the cache.
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