8217475: Unexpected StackOverflowError in "process reaper" thread

Reviewed-by: martin, dholmes
This commit is contained in:
Roger Riggs 2020-07-10 09:17:00 -04:00
parent 32482c82a6
commit a376fb7720

@ -87,8 +87,12 @@ final class ProcessHandleImpl implements ProcessHandle {
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent() != null) tg = tg.getParent();
ThreadGroup systemThreadGroup = tg;
// For a debug build, the stack shadow zone is larger;
// Increase the total stack size to avoid potential stack overflow.
int debugDelta = "release".equals(System.getProperty("jdk.debug")) ? 0 : (4*4096);
final long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize")
? 0 : REAPER_DEFAULT_STACKSIZE;
? 0 : REAPER_DEFAULT_STACKSIZE + debugDelta;
ThreadFactory threadFactory = grimReaper -> {
Thread t = new Thread(systemThreadGroup, grimReaper,