Skip to content

Apache Lucene open-source search software

Ignore the default ForkJoinPool's system threads in thread leak detection #14066

Dawid Weissb495a8632050
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/QuickPatchThreadsFilter.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/QuickPatchThreadsFilter.java
index 480c86438f3..191d5a49f70 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/QuickPatchThreadsFilter.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/QuickPatchThreadsFilter.java
@@ -19,6 +19,8 @@ package org.apache.lucene.tests.util;
import com.carrotsearch.randomizedtesting.ThreadFilter;
import org.apache.lucene.util.Constants;
+import java.util.concurrent.ForkJoinWorkerThread;
+
/** Last minute patches. */
public class QuickPatchThreadsFilter implements ThreadFilter {
static final boolean isJ9;
@@ -42,6 +44,15 @@ public class QuickPatchThreadsFilter implements ThreadFilter {
return true;
}
}
+
+ if (t instanceof ForkJoinWorkerThread
+ && t.getName().startsWith("ForkJoinPool.commonPool-worker")
+ && t.isDaemon()) {
+ // GH-14066: filter out common pool's worker threads. Assume they have completed
+ // all background tasks and are idle.
+ return true;
+ }
+
return false;
}
}