Skip to content

Serialize session registry access per request - #295

Open
AshSgDe29071999 wants to merge 1 commit into
gorilla:mainfrom
AshSgDe29071999:fix/registry-concurrent-get
Open

Serialize session registry access per request#295
AshSgDe29071999 wants to merge 1 commit into
gorilla:mainfrom
AshSgDe29071999:fix/registry-concurrent-get

Conversation

@AshSgDe29071999

Copy link
Copy Markdown

Fixes #287

Concurrent Get on the same *http.Request (typical of GraphQL subscriptions sharing a Gin context) raced in two places:

  • GetRegistry replaced *r with a context-bearing copy without a lock
  • Registry.sessions was a bare map

Either path can fatal with concurrent map writes. Guard registry attach with a mutex, and lock Get/Save on the per-request registry.

Concurrent Get calls on the same request raced on Registry.sessions and
on replacing the request context. GraphQL subscriptions hitting
sessions.Get from several goroutines could fatal with concurrent map
writes.

See gorilla#287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] .Get() — fatal error: concurrent map writes

1 participant