You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/05/10 02:17:16 UTC

[GitHub] [solr] risdenk commented on a diff in pull request #842: SOLR-16046: fix thread leaks from non-blocking ZooKeeper.close()

risdenk commented on code in PR #842:
URL: https://github.com/apache/solr/pull/842#discussion_r868751831


##########
solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java:
##########
@@ -210,7 +210,7 @@ public void update(ZooKeeper keeper) {
 
                 private void closeKeeper(ZooKeeper keeper) {
                   try {
-                    keeper.close();
+                    SolrZkClient.closeAsync(keeper);

Review Comment:
   Do we actually need to `closeAsync`? Can we always wait to close?



##########
solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestZkAclsWithHadoopAuth.java:
##########
@@ -106,6 +107,10 @@ public void testZkAcls() throws Exception {
       String zkHost = cluster.getSolrClient().getClusterStateProvider().getQuorumHosts();
       String zkChroot = zkHost.contains("/") ? zkHost.substring(zkHost.indexOf("/")) : null;
       walkZkTree(keeper, zkChroot, "/");
+    } finally {
+      // NOTE: cannot use try-with-resources, because `ZooKeeper.close()` without shutdownTimeout
+      // does not join on (and can leak) connection threads.

Review Comment:
   I'm not sure this logic belongs in `SolrZkClient`. We should use `try w/ resources` if possible. Can we override/extend `ZooKeeper` with a `SolrZooKeeper` or something that always closes Zookeeper the way we want? That way we get the benefit of try w/ resources and still get Zookeeper to close.



##########
solr/modules/hadoop-auth/src/test/org/apache/solr/security/hadoop/TestZkAclsWithHadoopAuth.java:
##########
@@ -106,6 +107,10 @@ public void testZkAcls() throws Exception {
       String zkHost = cluster.getSolrClient().getClusterStateProvider().getQuorumHosts();
       String zkChroot = zkHost.contains("/") ? zkHost.substring(zkHost.indexOf("/")) : null;
       walkZkTree(keeper, zkChroot, "/");
+    } finally {
+      // NOTE: cannot use try-with-resources, because `ZooKeeper.close()` without shutdownTimeout
+      // does not join on (and can leak) connection threads.

Review Comment:
   I'm not sure this logic belongs in `SolrZkClient`. We should use `try w/ resources` if possible. Can we override/extend `ZooKeeper` with a `SolrZooKeeper` or something that always closes Zookeeper the way we want? That way we get the benefit of try w/ resources and still get Zookeeper to close.



##########
solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java:
##########
@@ -210,7 +210,7 @@ public void update(ZooKeeper keeper) {
 
                 private void closeKeeper(ZooKeeper keeper) {
                   try {
-                    keeper.close();
+                    SolrZkClient.closeAsync(keeper);

Review Comment:
   Do we actually need to `closeAsync`? Can we always wait to close?



-- 
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: issues-unsubscribe@solr.apache.org

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


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