8249217: Unexpected StackOverflowError in "process reaper" thread still happens

Reviewed-by: martin, plevart, dholmes
This commit is contained in:
Roger Riggs 2020-07-24 11:00:50 -04:00
parent e6875c9bac
commit a0149f53f1
2 changed files with 9 additions and 5 deletions

View File

@ -36,6 +36,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.IntStream;
import java.util.stream.Stream;
@ -83,6 +84,9 @@ final class ProcessHandleImpl implements ProcessHandle {
*/
private static final Executor processReaperExecutor =
doPrivileged((PrivilegedAction<Executor>) () -> {
// Initialize ThreadLocalRandom now to avoid using the smaller stack
// of the processReaper threads.
ThreadLocalRandom.current();
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent() != null) tg = tg.getParent();

View File

@ -45,23 +45,23 @@ import java.nio.file.Paths;
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
*
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M
* -XX:G1HeapRegionSize=1M -XX:AbortVMOnException=java.lang.StackOverflowError
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation LARGEST_NON_HUMONGOUS
*
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M
* -XX:G1HeapRegionSize=1M -XX:AbortVMOnException=java.lang.StackOverflowError
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation SMALLEST_HUMONGOUS
*
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M
* -XX:G1HeapRegionSize=1M -XX:AbortVMOnException=java.lang.StackOverflowError
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation ONE_REGION_HUMONGOUS
*
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M
* -XX:G1HeapRegionSize=1M -XX:AbortVMOnException=java.lang.StackOverflowError
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation TWO_REGION_HUMONGOUS
*
* @run main/othervm -Xms128M -Xmx128M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:G1HeapRegionSize=1M
* -XX:G1HeapRegionSize=1M -XX:AbortVMOnException=java.lang.StackOverflowError
* gc.g1.humongousObjects.TestHumongousNonArrayAllocation MORE_THAN_TWO_REGION_HUMONGOUS
*
*/