JDK-8049864 : TestParallelHeapSizeFlags fails with unexpected heap size
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs25,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris
  • CPU: generic
  • Submitted: 2014-07-10
  • Updated: 2015-09-29
  • Resolved: 2014-09-15
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 8 JDK 9
8u60Fixed 9 b33Fixed
Related Reports
Blocks :  
Cloners :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Running the test on sparcv9 fails with this exception:
java.lang.RuntimeException: Heap has 8388608 bytes, expected to be less than 4194304
	at TestMaxHeapSizeTools.checkGenMaxHeapSize(TestMaxHeapSizeTools.java:254)
	at TestMaxHeapSizeTools.checkGenMaxHeapErgo(TestMaxHeapSizeTools.java:109)
	at TestParallelHeapSizeFlags.main(TestParallelHeapSizeFlags.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:744)


Comments
The issue had to be cloned since the first attempt to fix this had to be backed out. Even though the fix was correct, JDK-8049536 became much more visible, so JDK-8049536 must be fixed first.
10-07-2014

From the original bug: The problem is os::page_size_for_region, in particular the check: if ((region_min_size & mask) == 0 && (region_max_size & mask) == 0) If page_size_for_region is called with min_region_size and max_region_size that are a multiple of a page size larger than than max_page_size, then page_size_for_region will return that page. This problem manifests itself on Solaris using large pages. Solaris will use a page size of 2 MB. If -Xmx4m is used, then GenerationSizer::initialize_size_info will call page_size_for_region(4MB, 4MB, 8 /* min_pages*/). Since 4MB is a multiple 2MB, page_size_for_region will return 2MB. The bug is that we ask for at least 8 pages, which would limit the page size to 4MB/8 = 0.5MB (512 KB). Since parallel scavenge needs at least 4 pages, we get a heap size 4 * 2MB = 8MB, even though the user specified -Xmx4m!
10-07-2014