United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7132398 G1: java.lang.IllegalArgumentException: Invalid threshold: 9223372036854775807 > max (1073741824)
7132398 : G1: java.lang.IllegalArgumentException: Invalid threshold: 9223372036854775807 > max (1073741824)

Details
Type:
Bug
Submit Date:
2012-01-23
Status:
Closed
Updated Date:
2012-03-24
Project Name:
JDK
Resolved Date:
2012-03-24
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs23

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
In the nightly testing there are some failures like this:

# ERROR: Unexpected java.lang.IllegalArgumentException: Invalid threshold: 9223372036854775807 > max (1073741824). in pool G1 Old Gen
java.lang.IllegalArgumentException: Invalid threshold: 9223372036854775807 > max (1073741824).
        at sun.management.MemoryPoolImpl.setCollectionUsageThreshold(MemoryPoolImpl.java:224)
        at nsk.share.monitoring.MemoryMonitor.setCollectionThreshold(MemoryMonitor.java:680)
        at nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001.run(setthreshold001.java:119)
        at nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001.main(setthreshold001.java:18)
4 pool G1 Perm Gen
  supports collection usage thresholds
  threshold 85983232 is set
  threshold 0 is set
  threshold 0 is read
  Testcase 2. IllegalArgumentException is thrown
  Testcase 3. IllegalArgumentException is thrown
TEST FAILED

Some example log files:
http://sqeweb.us.oracle.com/nfs/results/vm/gtee/JDK7/NIGHTLY/VM/2012-01-20/G1_GC_Baseline/vm/linux-i586/client/mixed/linux-i586_vm_client_mixed_nsk.quick-monitoring.testlist/ResultDir/setthreshold001/setthreshold001.log

http://sqeweb.us.oracle.com/nfs/results/vm/gtee/JDK7/NIGHTLY/VM/2012-01-20/G1_GC_Baseline/vm/solaris-sparc/server/mixed/solaris-sparc_vm_server_mixed_nsk.quick-monitoring.testlist/ResultDir/setthreshold002/setthreshold002.log

http://sqeweb.us.oracle.com/nfs/results/vm/gtee/JDK7/NIGHTLY/VM/2012-01-20/G1_GC_Baseline/vm/linux-amd64/server/mixed/linux-amd64_vm_server_mixed_nsk.quick-monitoring.testlist/ResultDir/setthreshold005/setthreshold005.log

I was able to reproduce this on my local workstation using the UTE classes and this command line:

java -cp D:/Tests/ute/local/common/testbase/sqe/7/vm/vm/bin/classes -XX:+UseG1GC nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001

This issue was introduced with this changeset:

changeset:   2980:a8a126788ea0
user:        tonyp
date:        Thu Jan 19 09:13:58 2012 -0500
summary:     7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/877914d90c57
                                     
2012-03-22
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/877914d90c57
                                     
2012-01-25
EVALUATION

It turns out my fix for 7078465 (G1: Don't use the undefined value (-1) for the G1 old memory pool max size) was incomplete. The max_size() method of the G1 old pool returns the correct value. However, the max is also passed to the memory pool constructor (and that value seems to be cached and used by the memory pool). I missed passing the right value to the constructor.
                                     
2012-01-24
PUBLIC COMMENTS

Thanks to Bengt for writing a small test to reproduce this issue (see attached). It fails this way without the fix:

CollectionUsage NOT supported by: Code Cache
usage.getMax(): -1
Max is NOT supported by: G1 Eden Space
usage.getMax(): -1
Max is NOT supported by: G1 Survivor Space
usage.getMax(): -1
Max is NOT supported by: G1 Old Gen
Exception in thread "main" java.lang.IllegalArgumentException: Invalid threshold: 9223372036854775807 > max (268435456).
	at sun.management.MemoryPoolImpl.setCollectionUsageThreshold(MemoryPoolImpl.java:224)
	at MBeanMax.main(MBeanMax.java:36)

and passes with the fix:

CollectionUsage NOT supported by: Code Cache
usage.getMax(): -1
Max is NOT supported by: G1 Eden Space
usage.getMax(): -1
Max is NOT supported by: G1 Survivor Space
usage.getMax(): 268435456
Max is supported by: G1 Old Gen
usage.getMax(): 67108864
Max is supported by: G1 Perm Gen
                                     
2012-01-24



Hardware and Software, Engineered to Work Together