FrankYang0529 opened a new pull request, #22759:
URL: https://github.com/apache/kafka/pull/22759

   ### Why
   
   `BrokerJwtValidator#configure` obtains a `CloseableVerificationKeyResolver` 
from `VerificationKeyResolverFactory.get()` but never closes it, so the JWKS 
refresh thread of `RefreshingHttpsJwksVerificationKeyResolver` leaks.
   
   ### How
   
   - `BrokerJwtValidator`
     - Keeps a reference to the resolver obtained from the factory, configures 
it through the ref-counting wrapper, and releases it in `close()`.
     - An injected resolver is not closed. Its lifecycle is managed by the code 
that supplied it.
   - `VerificationKeyResolverFactory`
     - `create()` no longer configures the resolver; initialization is driven 
by the wrapper's `configure()`.
     - `RefCountingVerificationKeyResolver` removes its cache entry when the 
last reference is closed, so a subsequent `get()` with the same configuration 
builds a fresh resolver instead of returning the closed one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to