Skip to content

Apache Lucene open-source search software

Moved system.out from the forked subprocess to test because it uses inherited i/o handles directly and shows as unexpected JVM output.

Dawid Weiss469979dc25ac
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java b/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
index 8137f23f280..8080c87693f 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
@@ -61,8 +61,11 @@ public class TestCodecLoadingDeadlock extends Assert {
.get(rnd.nextInt(avail.size()));
final String dvfName = new ArrayList<>(avail = DocValuesFormat.availableDocValuesFormats())
.get(rnd.nextInt(avail.size()));
-
- // spawn separate JVM:
+
+ System.out.println(String.format(Locale.ROOT,
+ "codec: %s, pf: %s, dvf: %s", codecName, pfName, dvfName));
+
+ // Fork a separate JVM to reinitialize classes.
final Process p = new ProcessBuilder(
Paths.get(System.getProperty("java.home"), "bin", "java").toString(),
"-cp",
@@ -86,9 +89,6 @@ public class TestCodecLoadingDeadlock extends Assert {
final String pfName = args[1];
final String dvfName = args[2];
- System.out.println(String.format(Locale.ROOT,
- "codec: %s, pf: %s, dvf: %s", codecName, pfName, dvfName));
-
final int numThreads = 14; // two times the modulo in switch statement below
final CopyOnWriteArrayList<Thread> allThreads = new CopyOnWriteArrayList<>();
final ExecutorService pool = Executors.newFixedThreadPool(numThreads, new NamedThreadFactory("deadlockchecker") {