8086278: java/lang/ProcessHandle/TreeTest.java failed - ProcessReaper StackOverflowException
authorrriggs
Wed, 13 Apr 2016 16:57:49 -0400
changeset 37350 944a8584d0fb
parent 37349 648609dc0f3d
child 37351 20eb86bd7c9f
8086278: java/lang/ProcessHandle/TreeTest.java failed - ProcessReaper StackOverflowException Summary: Increase reaper stack size by 50% to 48k Reviewed-by: chegar, martin
jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Wed Apr 13 11:03:16 2016 -0700
+++ b/jdk/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);