You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/05/28 12:56:02 UTC

[GitHub] [iceberg] rymurr commented on a change in pull request #2649: Hive: CachedClientPool connection leak

rymurr commented on a change in pull request #2649:
URL: https://github.com/apache/iceberg/pull/2649#discussion_r641526618



##########
File path: core/src/main/java/org/apache/iceberg/ClientPoolImpl.java
##########
@@ -36,6 +38,10 @@
   private volatile int currentSize;
   private boolean closed;
 
+  private static volatile AtomicInteger openCount = new AtomicInteger(0);

Review comment:
       I am not sure if I understand the purpose of these three variables

##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/CachedClientPool.java
##########
@@ -65,6 +65,8 @@ private synchronized void init() {
               .removalListener((key, value, cause) -> ((HiveClientPool) value).close())
               .build();
     }
+    // cleanup cache before jvm exit, avoid some clients may not be closed.
+    Runtime.getRuntime().addShutdownHook(new Thread(CachedClientPool::cleanupCache));

Review comment:
       What is the downside of not closing the clients when the JVM exits? IMHO the lifetime of the client pool should be tied to the owning resources and be cleaned up through a `Closeable` interface rather than at system exit




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org