JDK-8146751 : jdk/test/tools/launcher/TooSmallStackSize.java failed on Mac OS
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2016-01-11
  • Updated: 2020-09-01
  • Resolved: 2016-01-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b105Fixed
Related Reports
Relates :  
Relates :  
Description
----------messages:(5/315)----------
JDK under test: (/Users/yqi/ws/jdks/recent)
java version "9-internal"
Java(TM) SE Runtime Environment (build 9-internal+0-2016-01-08-215809.amurillo.jdk9-hs-2016-01-05-8146521-control)
Java HotSpot(TM) 64-Bit Server VM (build 9-internal+0-2016-01-08-215809.amurillo.jdk9-hs-2016-01-05-8146521-control, mixed mode)

...

----------System.out:(3/184)----------
PASSED: got expected error message with stack size of 16k
PASSED: got expected error message with stack size of 32k
FAILED: VM failed to launch with minimum allowed stack size of 100k
----------System.err:(14/774)----------
java.lang.RuntimeException: test fails
        at TooSmallStackSize.checkMinStackAllowed(TooSmallStackSize.java:130)
        at TooSmallStackSize.main(TooSmallStackSize.java:156)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:520)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
        at java.lang.Thread.run(Thread.java:804)

JavaTest Message: Test threw exception: java.lang.RuntimeException: test fails
JavaTest Message: shutting down test

Looks the MinStackAllowed changed from 160K to 100K (earlier version use 160K):

java  -Xss100K -version

The stack size specified is too small, Specify at least 100k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit. 
Comments
This is an integration_blocker at the JDK9-hs level. Our choices are: 1) push a change that quarantines this test to JDK9-hs and push Fred's fix to JDK9-hs-rt for proper nightly testing cycles 2) push Fred's fix to JDK9-hs directly (with Alejandro's approval). Just checked and Fred is already pushing this fix to JDK9-hs-rt via JPRT. So we need to quarantine this test in JDK9-hs.
19-01-2016

The fix for JDK-8139864 is broken for both BSD (as Fred determined) and Solaris, due to missing parentheses in the calculation. That results in this test failing , at least on OSX.
19-01-2016

I got the PIT cert from SQE already, so I'm ready to push to jdk9/dev but I can't until this test is fixed in jdk9/hs or it is excluded. It is a tier1 test There are over 150 changes pending to be pushed to jdk9/dev, so we need a resolution by Tuesday morning PT.
19-01-2016

[sc14if09:~/8146751]$ ./bin/java -Xss100K -version The stack size specified is too small, Specify at least 108k Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [sc14if09:~/8146751]$ ./bin/java -Xss108K -version The stack size specified is too small, Specify at least 108k Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [sc14if09:~/8146751]$ ./bin/java -Xss116K -version # To suppress the following error report, specify this argument # after -XX: or in .hotspotrc: SuppressErrorAt=/exceptions.cpp:229 # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/opt/jprt/T/P1/103712.fparain/s/hotspot/src/share/vm/utilities/exceptions.cpp:229), pid=47032, tid=7683 # assert(InstanceKlass::cast(k)->is_initialized()) failed: need to increase min_stack_allowed calculation # # JRE version: (9.0) (build ) # Java VM: Java HotSpot(TM) 64-Bit Server VM (9-internal+0-2016-01-18-103712.fparain.hs, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64) # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /home/fparain/8146751/hs_err_pid47032.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # Current thread is 7683 Dumping core ... Abort trap: 6 [sc14if09:~/8146751]$ ./bin/java -Xss160K -version java version "9-internal" Java(TM) SE Runtime Environment (fastdebug build 9-internal+0-2016-01-18-103712.fparain.hs) Java HotSpot(TM) 64-Bit Server VM (fastdebug build 9-internal+0-2016-01-18-103712.fparain.hs, mixed mode) At least two issues here: 1 - the recommended minimal size is rejected 2 - a size slightly bigger than the recommended minimal size causes an assertion failure Issue number 2 is caused by a stack too small to initialize the StackOverflowError class. It seems to be a consequence of the bug in the code checking the minimal stack size. These issues can be reproduced on MaxOSX, but not in Linux_x86_64.
18-01-2016

Proposed fix: % hg diff diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp --- a/src/os/bsd/vm/os_bsd.cpp +++ b/src/os/bsd/vm/os_bsd.cpp @@ -3481,7 +3481,7 @@ os::Bsd::min_stack_allowed = MAX2(os::Bsd::min_stack_allowed, JavaThread::stack_guard_zone_size() + JavaThread::stack_shadow_zone_size() + - 2*BytesPerWord COMPILER2_PRESENT(+1) * Bsd::page_size()); + (2*BytesPerWord COMPILER2_PRESENT(+1)) * Bsd::page_size()); size_t threadStackSizeInBytes = ThreadStackSize * K; if (threadStackSizeInBytes != 0 && Here's the behaviour of the VM with this fix when testing same configurations as above: $ ./bin/java -Xss100k -version The stack size specified is too small, Specify at least 172k Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [sc14if09:~/8146751/hs-rt-fix]$ ./bin/java -Xss116k -version The stack size specified is too small, Specify at least 172k Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [sc14if09:~/8146751/hs-rt-fix]$ ./bin/java -Xss172k -version java version "9-internal" Java(TM) SE Runtime Environment (fastdebug build 9-internal+0-2016-01-18-145552.fparain.hs-rt) Java HotSpot(TM) 64-Bit Server VM (fastdebug build 9-internal+0-2016-01-18-145552.fparain.hs-rt, mixed mode)
18-01-2016

Linux version: os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, JavaThread::stack_guard_zone_size() + JavaThread::stack_shadow_zone_size() + (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size()); BSD version: os::Bsd::min_stack_allowed = MAX2(os::Bsd::min_stack_allowed, JavaThread::stack_guard_zone_size() + JavaThread::stack_shadow_zone_size() + 2*BytesPerWord COMPILER2_PRESENT(+1) * Bsd::page_size()); Note the difference between the computation of the min_stack_allowed value for the Linux and the BSD OSes. The missing parentheses on the BSD version changed the minimal stack size to a lower value. This changed has been introduced by changeset 9772:3125c4a60cc9 "8139864: Improve handling of stack protection zones.". Before this changeset, both Linux and BSD had the same formula to compute the minimal stack size.
18-01-2016

This is a tier1 test, so it will prevent the integration of this week jdk9/hs snapshot into jdk9/dev next week, hence the P1 priority. Please push the fix to jdk9/hs asap (or exclude the test if justifiable). It only fails on macosx
15-01-2016