You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2026/08/01 22:44:28 UTC

Re: [PR] [SPARK-58472][CORE] Add `AutoCloseable` lifecycle to `CredentialProvider` SPI [spark]

dongjoon-hyun commented on code in PR #57677:
URL: https://github.com/apache/spark/pull/57677#discussion_r3696832602


##########
core/src/main/java/org/apache/spark/security/CredentialProvider.java:
##########
@@ -101,4 +101,20 @@ public interface CredentialProvider {
   default Duration suggestedTtl() {
     return Duration.ofMinutes(15);
   }
+
+  /**
+   * Releases any resources held by this provider (e.g., HTTP clients, connection pools).
+   * <p>
+   * Called by the credential management layer during shutdown. The default implementation
+   * is a no-op; providers that allocate long-lived resources in {@link #init(Map)} should
+   * override this method to clean them up.
+   * <p>

Review Comment:
   `stop()` calls `shutdownNow()` (interrupt only, no wait) and then `closeAll()` immediately, so `close()` can run while a renewal task is still inside `resolve()`. Since this is an SPI, that concurrency contract should be spelled out for implementors:
   
   ```suggestion
      * <p>
      * {@code close()} may be invoked while another thread is still executing
      * {@link #resolve(UserContext, URI)}: shutdown interrupts the renewal thread but does
      * not wait for in-flight calls to complete. Implementations must tolerate a concurrent
      * or subsequent {@code resolve()} failing after resources have been released, and
      * {@code close()} itself must not block indefinitely.
      * <p>
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org