JDK-6653214 : MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 5.0u12,6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2008-01-21
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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 6 JDK 7 Other
6u12Fixed 7Fixed hs11.2Fixed
Description
FULL PRODUCT VERSION :
Java HotSpot(TM) Server VM (1.5.0_12-b04) for linux-x86, built on May
2 2007 02:13:16 by java_re with gcc 3.2.1-7a (J2SE release)

ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.9-55.0.2.ELsmp #1 SMP Tue Jun 12 17:58:20 EDT 2007 x86_64
libc:glibc 2.3.4 NPTL 2.3.4


A DESCRIPTION OF THE PROBLEM :
Even though MemoryPoolMXBean.setUsageThreshold() accepts a long argument, attempting to set to a large value (for example a very large heap) on a 64-bit OS but using a 32-bit VM results in:

java.lang.IllegalArgumentException: Invalid threshold value > max value of size_t
        at sun.management.MemoryPoolImpl.setUsageThreshold0(Native Method)
        at sun.management.MemoryPoolImpl.setUsageThreshold(MemoryPoolImpl.java:122)



ERROR MESSAGES/STACK TRACES THAT OCCUR :
ava.lang.IllegalArgumentException: Invalid threshold value > max value of size_t
        at sun.management.MemoryPoolImpl.setUsageThreshold0(Native Method)
        at sun.management.MemoryPoolImpl.setUsageThreshold(MemoryPoolImpl.java:122)

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/2494ab195856
17-12-2008

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-svc/hotspot/rev/2494ab195856
16-12-2008

SUGGESTED FIX In vm threshold check we use max_intx and changing this to max_uintx fixes this problem.
14-11-2008

EVALUATION The problem is in 32bit jvm in setting threshold value greater than 3GB but less than 4GB. On 32bit vm max memory allowed is 4GB. So it setting threshold value is limited to 4GB only.
14-11-2008

SUGGESTED FIX Fix the threshold range check in the jmm_SetPoolThreshold function (in services/management.cpp) to check against the max jlong value.
10-07-2008

EVALUATION It's a bug in the VM implementation that checks for the range within max integer value.
23-01-2008