Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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.
- Loading branch information
1 parent
b93bc13
commit bc40839
Showing
3 changed files
with
111 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters