Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v11] Prevent races creating web api session context #23735

Merged
merged 1 commit into from
Mar 28, 2023

Commits on Mar 28, 2023

  1. Prevent races creating web api session context (#23691)

    Closes #23533 and #20963.
    
    There was a race to create the `web.SessionContext` for a session
    when multiple Proxies are behind a load balancer. Only the Proxy
    that processes the login will have a `web.SessionContext` created
    for the session. Any subsequent requests to the other Proxies in
    the pool would create one if the request was authenticated. However,
    multiple requests within a short succession could cause a
    single Proxy to create multiple `web.SessionContext` for a single
    session. When that happens the most recently created `web.SessionContext`
    gets saved and the previous `web.SessonContext` gets closed. Closing
    causes the `auth.Client` to be closed, which causes any active requests
    for that client to return with a `grpc: client connection is closing`
    error. This manifests in a single request from the web UI to fail
    and depending on the request, for a banner to be displayed with the
    error. Refreshing the page or navigating to another page would
    resolve the problem because the most recent `web.SessionContext`
    would be used with the still open `auth.Client`.
    
    To prevent `web.Handler.AuthenticateRequest` from racing to create
    the `web.SessionContext` a `singleflight.Group` was added to the
    `web.sessionCache`. When multiple requests come in for the same
    session they now will all use the first `web.SessionContext` to
    be created instead of each creating their own.
    rosstimothy committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    2b3a19b View commit details
    Browse the repository at this point in the history