JDK-8020530 : Non heap memory size calculated incorrectly; IllegalArgumentException: committed = N should be < max
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-07-15
  • Updated: 2014-06-23
  • Resolved: 2013-08-23
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 JDK 8 Other
6u81Fixed 7u60Fixed 8Fixed hs25Fixed
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
In which JDK 8 build can the fix be expected?
02-08-2013

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)
19-07-2013