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

This commit is contained in:
Dawid Weiss 2024-12-14 20:05:52 +01:00
parent 9bf2b2064b
commit b495a86320
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}
}