mchades commented on code in PR #14407:
URL: https://github.com/apache/gravitino/pull/14407#discussion_r4581561054


##########
catalogs/hadoop-common/src/main/java/org/apache/gravitino/catalog/hadoop/fs/HDFSFileSystemProxy.java:
##########
@@ -182,6 +245,69 @@ private synchronized void close() {
       }
       kerberosClient = null;
     }
+    if (keytabFile != null) {
+      try {
+        Files.deleteIfExists(keytabFile.toPath());
+      } catch (IOException | RuntimeException e) {
+        LOG.warn("Failed to delete the keytab file {}", keytabFile, e);
+      }
+      LIVE_KEYTAB_FILES.remove(keytabFile);

Review Comment:
   If `Files.deleteIfExists()` throws, this still removes the path from 
`LIVE_KEYTAB_FILES`, so the shutdown hook cannot retry. I made the `keytabs` 
directory read-only during `close()` and restored write access before exit. The 
temporary keytab symlink remained after a normal JVM exit. Could we move 
`LIVE_KEYTAB_FILES.remove(keytabFile)` into the `try` block immediately after 
`deleteIfExists()`?



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