United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8020530 : Non heap memory size calculated incorrectly; IllegalArgumentException: committed = N should be < max

Details
Type:
Bug
Submit Date:
2013-07-15
Status:
Closed
Updated Date:
2014-06-23
Project Name:
JDK
Resolved Date:
2013-08-23
Component:
core-svc
OS:
Sub-Component:
java.lang.management
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:
hs25 (b48)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
Rung WebLogic server with 1.8.0 encounters this error:

Caused by: java.lang.IllegalArgumentException: committed = 86482944 should be < max = 50331648

        at java.lang.management.MemoryUsage.<init>(MemoryUsage.java:162)

        at sun.management.MemoryImpl.getMemoryUsage0(Native Method)

        at sun.management.MemoryImpl.getNonHeapMemoryUsage(MemoryImpl.java:75)

       ... 37 more

There is a bug in jmm_GetMemoryUsage here -- if a memory region does not define a maximum size, then the total_max is not updated:
      if (u.max_size() == (size_t)-1) {
        has_undefined_max_size = true;
      }
      if (!has_undefined_max_size) {
        total_max += u.max_size();
      }
But there memory region does define a committed size -- so the committed size is increased and the total_max size is not, and so the committed size ends up larger than the total_max size.

This occurs at least for the Metaspace region (pool->name() returns Metaspace) Which means, I suppose, that the metaspace region has a bug that it is not returning the maximum size? But also the management code should correctly report the maximum size in this instance as undefined rather than throwing an exception.
                                    

Comments
The exception appears also at startup of NetBeans. It started with JDK version 1.8.0-ea-b97.

The stacktrace:
java.lang.IllegalArgumentException: committed = 62668800 should be < max = 50331648
   at java.lang.management.MemoryUsage.<init>(MemoryUsage.java:162)
   at sun.management.MemoryImpl.getMemoryUsage0(MemoryImpl.java:0)
   at sun.management.MemoryImpl.getNonHeapMemoryUsage(MemoryImpl.java:75)
   at org.netbeans.core.ui.warmup.DiagnosticTask.logParams(DiagnosticTask.java:193)
   at org.netbeans.core.ui.warmup.DiagnosticTask.run(DiagnosticTask.java:82)
   at org.netbeans.core.startup.WarmUpSupport.run(WarmUpSupport.java:98)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

                                     
2013-07-19
In which JDK 8 build can the fix be expected?
                                     
2013-08-02
URL:   http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a70566600baf
User:  poonam
Date:  2013-08-23 06:38:47 +0000

                                     
2013-08-23
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/a70566600baf
User:  amurillo
Date:  2013-08-30 10:57:24 +0000

                                     
2013-08-30



Hardware and Software, Engineered to Work Together