You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/09 04:44:38 UTC

[GitHub] [spark] LuciferYang commented on a diff in pull request #36484: [SPARK-39127][CORE] Fix potential risk of `LevelDBIterator` leak

LuciferYang commented on code in PR #36484:
URL: https://github.com/apache/spark/pull/36484#discussion_r867627116


##########
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java:
##########
@@ -385,6 +380,33 @@ private byte[] getTypeAlias(Class<?> klass) throws Exception {
     return alias;
   }
 
+  private void stopCleanupThread() throws InterruptedException {
+    if (cleaningThread != null) {
+      stopped = true;
+      cleaningThread.join();
+    }
+  }
+
+  private void keepCleaning() {
+    boolean lastIsPresent = false;
+    while (!stopped || lastIsPresent) {
+      try {
+        Optional<? extends Reference<? extends LevelDBIterator<?>>> removed =
+          Optional.ofNullable(referenceQueue.remove(1000L));
+        lastIsPresent = removed.isPresent();
+        System.out.println("lastIsPresent is " + lastIsPresent);

Review Comment:
   will delete this line



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org