dongjoon-hyun commented on code in PR #57677:
URL: https://github.com/apache/spark/pull/57677#discussion_r3696835087
##########
core/src/main/scala/org/apache/spark/deploy/security/UserCredentialManager.scala:
##########
@@ -130,6 +130,16 @@ private[spark] class UserCredentialManager(
if (renewalExecutor != null) {
renewalExecutor.shutdownNow()
}
+ // Close all initialized credential providers to release resources (e.g.,
HTTP clients).
+ // CredentialProviderLoader.closeAll() operates on global static state,
which is safe
+ // because Spark enforces a single SparkContext (and thus a single
UserCredentialManager)
+ // per JVM.
+ try {
+ CredentialProviderLoader.closeAll()
+ } catch {
+ case NonFatal(e) =>
+ logWarning(log"Error closing credential providers during shutdown.", e)
Review Comment:
Scala's `NonFatal` does not match `InterruptedException`, so if a provider's
`close()` throws it (plausible for HTTP client shutdown waits), it escapes
`stop()` and can disrupt the caller's shutdown path. A shutdown hook should
swallow it after restoring the interrupt flag.
```suggestion
case e: InterruptedException =>
Thread.currentThread().interrupt()
logWarning(log"Interrupted while closing credential providers during
shutdown.", e)
case NonFatal(e) =>
logWarning(log"Error closing credential providers during shutdown.",
e)
```
--
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]