You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Release per-issuer JWKS refresh workers on auth-server shutdown #6482
MultiIssuerTokenValidator starts one jwk.Cache per configured trusted issuer, each with its own httprc worker pool rooted at context.Background() (pkg/authserver/server/tokenexchange/multi_issuer_validator.go). The in-file comment is explicit that these run "for the life of the process" and to "budget roughly three goroutines per issuer".
Nothing releases them. Neither authserver.Server.Close() nor the new Server.CloseIdleConnections() reaches the validator, and jwk.Cache.Shutdown is never called.
Why this matters
This is the goroutine half of #6479. That issue's failure mode is a long-lived process that reconstructs the auth server to change its upstream set. #6480 fixed the HTTP-connection half — upstream pools are now bounded and drainable — but a reconstruction still leaks one worker pool per trusted issuer, unbounded.
It also reopens the pathological retry case for this resource specifically: buildProvider runs afterbuildUpstreams, so a reconstruction that fails past the upstream stage abandons the whole validator, and newServer's deferred drain covers only upstreams.
The gap is currently documented in the Scope: paragraph on Server.CloseIdleConnections; this issue is what that paragraph should eventually point at.
Suggested approach
Give MultiIssuerTokenValidator a Close/Shutdown that shuts down each per-issuer jwk.Cache.
Root the caches in a server-scoped context rather than context.Background().
Hold the validator on server and call it from both Close() and newServer's deferred error path.
Note pkg/auth/token.go's TokenValidator has the same shape, per the existing comment, so the fix may want to cover both.
Activity
Require a shared validator for trusted-issuer factories
Release per-issuer JWKS refresh workers on auth-server shutdown (#6493)
Close leaked test validators and fix validator-sharing docs (#6504)