Copilot commented on code in PR #15910:
URL: https://github.com/apache/iceberg/pull/15910#discussion_r3050512046


##########
core/src/main/java/org/apache/iceberg/CachingCatalog.java:
##########
@@ -98,6 +98,13 @@ public void onRemoval(TableIdentifier tableIdentifier, Table 
table, RemovalCause
       if (RemovalCause.EXPIRED.equals(cause)) {
         if (!MetadataTableUtils.hasMetadataTableName(tableIdentifier)) {
           tableCache.invalidateAll(metadataTableIdentifiers(tableIdentifier));
+          if (table != null) {
+            try {
+              table.io().close();
+            } catch (Exception e) {
+              LOG.warn("Failed to close FileIO for evicted table {}", 
tableIdentifier, e);
+            }

Review Comment:
   The close logic only runs when the removal cause is EXPIRED. Caffeine can 
also remove entries due to COLLECTED (softValues GC) and potentially SIZE (if a 
max-size/weight policy is added); in those cases the FileIO would still not be 
closed and the thread leak described in #15898 can persist. Consider running 
the same invalidation/close path for all eviction causes (e.g., 
`cause.wasEvicted()`), while still skipping metadata table identifiers.



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