Skip to content

Commit e63499d

Browse files
author
Andrew Lu
committed
8217475: Unexpected StackOverflowError in "process reaper" thread
Backport-of: a376fb7
1 parent 3ea286a commit e63499d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/java.base/share/classes/java/lang/ProcessHandleImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ final class ProcessHandleImpl implements ProcessHandle {
8787
ThreadGroup tg = Thread.currentThread().getThreadGroup();
8888
while (tg.getParent() != null) tg = tg.getParent();
8989
ThreadGroup systemThreadGroup = tg;
90+
91+
// For a debug build, the stack shadow zone is larger;
92+
// Increase the total stack size to avoid potential stack overflow.
93+
int debugDelta = "release".equals(System.getProperty("jdk.debug")) ? 0 : (4*4096);
9094
final long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize")
91-
? 0 : REAPER_DEFAULT_STACKSIZE;
95+
? 0 : REAPER_DEFAULT_STACKSIZE + debugDelta;
9296

9397
ThreadFactory threadFactory = grimReaper -> {
9498
Thread t = new Thread(systemThreadGroup, grimReaper,

0 commit comments

Comments
 (0)