Repository navigation
auth: share one LocalAPI client across tailscale_auth modules - #148
Open
anuragbanerjee wants to merge 1 commit into
Open
anuragbanerjee wants to merge 1 commit into
anuragbanerjee wants to merge 1 commit into
Conversation
Each Auth on the system tailscaled path built its own local.Client, and a client cannot close its idle connections. Authenticate's value receiver stranded one per request, and Caddy building new modules on each config load stranded one per reload. One process-wide client stops both. Fixes tailscale#147 Change-Id: Ib5ae8d26152e0b2a3a6d213064ed7ce4a39f34de Signed-off-by: Anurag Banerjee <anuragbanerjee@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every
tailscale_authmodule on the system tailscaled path builds its ownlocal.Client, and a client can't close its idle connections.Authenticate's value receiver strands one on every request, which #140 and #146 fix. Caddy building new modules strands one on every config reload, which neither of them covers.This uses one process-wide client on that path, which stops both leaks with no receiver change or mutex. The tsnet path already uses its server's client and is unchanged. The same change also works on top of #140 if you'd rather land that first.
Established LocalAPI connections with 20
tailscale_authroutes and 380 authenticated requests, on macOS with Tailscale 1.104.1. The reproduction is in #147.de41b249af4fTesting:
go test -race ./...passes, golangci-lint v2.12.0 reports no new issues, and the new test fails without the change.Fixes #147