changeset 14163:b473d38d7a9f

8086278: java/lang/ProcessHandle/TreeTest.java failed - ProcessReaper StackOverflowException Summary: Increase reaper stack size by 50% to 48k Reviewed-by: chegar, martin
author rriggs
date Wed, 13 Apr 2016 16:57:49 -0400
parents 77abaa01adf2
children 9c0350e7bb36
files src/java.base/share/classes/java/lang/ProcessHandleImpl.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Wed Apr 13 11:03:16 2016 -0700
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Wed Apr 13 16:57:49 2016 -0400
@@ -52,6 +52,11 @@
  */
 final class ProcessHandleImpl implements ProcessHandle {
     /**
+     * Default size of stack for reaper processes.
+     */
+    private static long REAPER_DEFAULT_STACKSIZE = 128 * 1024;
+
+    /**
      * Cache the ProcessHandle of this process.
      */
     private static final ProcessHandleImpl current;
@@ -79,10 +84,12 @@
                 ThreadGroup tg = Thread.currentThread().getThreadGroup();
                 while (tg.getParent() != null) tg = tg.getParent();
                 ThreadGroup systemThreadGroup = tg;
+                final long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize")
+                        ? 0 : REAPER_DEFAULT_STACKSIZE;
 
                 ThreadFactory threadFactory = grimReaper -> {
-                    long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize") ? 0 : 32768;
-                    Thread t = new Thread(systemThreadGroup, grimReaper, "process reaper", stackSize);
+                    Thread t = new Thread(systemThreadGroup, grimReaper,
+                            "process reaper", stackSize, false);
                     t.setDaemon(true);
                     // A small attempt (probably futile) to avoid priority inversion
                     t.setPriority(Thread.MAX_PRIORITY);