The fix for JDK-6762191 forced the stack size to be at least 32k if you specified something smaller with -Xss. This allowed you to get to the point where hotspot determines the actual minimum stack size, and will generate an appropriate error message stating such. Before doing this, very small stack sizes would crash before ever getting to the point where hotspot tells you the stack size is too small. It looks like 32k is not always big enough on Mac OS X. I've noticed TooSmallStackSize.java failing sometimes because of this. The following demonstrates this:
$> bin/java -Xss16k -version
Error occurred during initialization of VM
Unable to load native library: dlopen(/home/cplummer/macos/lib/libjava.dylib, 1): no suitable image found. Did find:
/home/cplummer/macos/lib/libjava.dylib: pread of first 4K failed: 14
$> bin/java -Xss32k -version
Error occurred during initialization of VM
Unable to load native library: dlopen(/home/cplummer/macos/lib/libjava.dylib, 1): no suitable image found. Did find:
/home/cplummer/macos/lib/libjava.dylib: pread of first 4K failed: 14
$> bin/java -Xss36k -version
Bus error
$> bin/java -Xss40k -version
Bus error
$> bin/java -Xss44k -version
The Java thread stack size specified is too small. Specify at least 152k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
So it looks like at least on this machine we need STACK_SIZE_MINIMUM to be more than 40k, and 44k is enough. The behavior differed depending on the machine. The test passed most of the time with 32k. I think maybe just some of the machines require more stack space.
$> bin/java -Xss16k -version
Error occurred during initialization of VM
Unable to load native library: dlopen(/home/cplummer/macos/lib/libjava.dylib, 1): no suitable image found. Did find:
/home/cplummer/macos/lib/libjava.dylib: pread of first 4K failed: 14
$> bin/java -Xss32k -version
Error occurred during initialization of VM
Unable to load native library: dlopen(/home/cplummer/macos/lib/libjava.dylib, 1): no suitable image found. Did find:
/home/cplummer/macos/lib/libjava.dylib: pread of first 4K failed: 14
$> bin/java -Xss36k -version
Bus error
$> bin/java -Xss40k -version
Bus error
$> bin/java -Xss44k -version
The Java thread stack size specified is too small. Specify at least 152k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
So it looks like at least on this machine we need STACK_SIZE_MINIMUM to be more than 40k, and 44k is enough. The behavior differed depending on the machine. The test passed most of the time with 32k. I think maybe just some of the machines require more stack space.
- relates to
-
JDK-8222334 java -Xss0 triggers StackOverflowError
-
- Resolved
-
-
JDK-6762191 Setting stack size to 16K causes segmentation fault
-
- Resolved
-