Skip to content

Commit

Permalink
8217475: Unexpected StackOverflowError in "process reaper" thread
Browse files Browse the repository at this point in the history
Backport-of: a376fb7
  • Loading branch information
Andrew Lu committed Dec 8, 2023
1 parent 3ea286a commit e63499d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/java.base/share/classes/java/lang/ProcessHandleImpl.java
Expand Up @@ -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,
Expand Down

1 comment on commit e63499d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.