pan3793 opened a new pull request, #57953:
URL: https://github.com/apache/spark/pull/57953

   ### What changes were proposed in this pull request?
   
   Wrap the token acquisition in `KafkaTokenUtil.obtainToken` in 
`try`/`finally` so the created `AdminClient` is always closed, via 
`Utils.closeQuietly`.
   
   ### Why are the changes needed?
   
   `obtainToken` creates an `AdminClient` but never closes it, on either the 
success or the exception path. Each token obtain (per cluster, per renewal 
cycle) and each failed attempt leaks the client's network thread and sockets, 
which accumulate in long-running drivers.
   
   Present since the feature was introduced in SPARK-25501 (Spark 3.0.0).
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing tests (`KafkaTokenUtilSuite`).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-fable-5)
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to