Copilot commented on code in PR #11304:
URL: https://github.com/apache/gravitino/pull/11304#discussion_r3371188563


##########
clients/filesystem-hadoop3/src/main/java/org/apache/gravitino/filesystem/hadoop/BaseGVFSOperations.java:
##########
@@ -274,14 +285,15 @@ protected Optional<FilesetMetadataCache> 
getFilesetMetadataCache() {
 
   @Override
   public void close() throws IOException {
-    // close all actual FileSystems
-    for (FileSystem fileSystem : fileSystemCache.asMap().values()) {
+    // Close every FS we created, including those already evicted from the 
cache (see #11303).
+    for (FileSystem fileSystem : allCreatedFileSystems) {
       try {
         fileSystem.close();
       } catch (IOException e) {
-        // ignore
+        LOG.warn("Failed to close FileSystem during GVFS shutdown: {}", 
fileSystem, e);
       }
     }
+    allCreatedFileSystems.clear();
     fileSystemCache.invalidateAll();
 

Review Comment:
   In closeOnEviction (legacy) mode, BaseGVFSOperations#close() currently 
closes allCreatedFileSystems first and then calls 
fileSystemCache.invalidateAll(). Since invalidateAll triggers the 
removalListener, this will close still-cached FileSystem instances a second 
time at shutdown. Reorder shutdown so the cache is invalidated first (allowing 
the legacy listener path to close+untrack cached FS), then close whatever 
remains in allCreatedFileSystems (evicted-but-tracked FS in the default mode).



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