United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6980206 G1: assert(!has_undefined_max_size, "Undefined max size");
JDK-6980206 : G1: assert(!has_undefined_max_size, "Undefined max size");

Details
Type:
Bug
Submit Date:
2010-08-26
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs19
Fixed Versions:
hs20 (b01)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
The changes for 6941275 (G1: The MemoryPools are incorrectly supported for G1) are tripping over an assert in management.cpp:

[2010-08-26T10:29:55.78] # Actual: /export/local/common/jdk/baseline/linux-i586/bin/java -client -Xmixed -XX:-PrintVMOptions -XX:+UseG1GC -XX:+StartAttachListener -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:-UseGCOverheadLimit vm.gc.containers.ContainersTest -ms low -ct LinkedHashMap(random(arrays))
[2010-08-26T10:29:55.78] # To suppress the following error report, specify this argument
[2010-08-26T10:29:56.94] # after -XX: or in .hotspotrc:  SuppressErrorAt=/management.cpp:791
[2010-08-26T10:29:56.94] #
[2010-08-26T10:29:56.94] # A fatal error has been detected by the Java Runtime Environment:
[2010-08-26T10:29:56.94] #
[2010-08-26T10:29:56.94] #  Internal Error (/tmp/jprt/P1/B/214611.jcoomes/source/src/share/vm/services/management.cpp:791), pid=23426, tid=3072813968
[2010-08-26T10:29:56.94] #  assert(!has_undefined_max_size) failed: Undefined max size
[2010-08-26T10:29:56.94] #
[2010-08-26T10:29:56.94] # JRE version: 7.0
[2010-08-26T10:29:56.94] # Java VM: OpenJDK Client VM (19.0-b06-201008252146.jcoomes.6978300-g1-gcthread-fastdebug mixed mode linux-x86 )
[2010-08-26T10:29:56.94] # An error report file with more information is saved as:
[2010-08-26T10:29:56.94] # /export/local/37621.JDK7.NIGHTLY.VM+linux-i586_vm_client_mixed_vm.gc.testlist/results/ResultDir/LinkedHashMap_Arrays/hs_err_pid23426.log
[2010-08-26T10:29:56.94] #
[2010-08-26T10:29:56.94] # If you would like to submit a bug report, please visit:
[2010-08-26T10:29:56.94] #   http://java.sun.com/webapps/bugreport/crash.jsp
[2010-08-26T10:29:56.94] #

It looks as if there are some assumptions in the management code that the max should be defined.

                                    

Comments
EVALUATION

We thought that the easiest way to map G1's operation to the memory pool abstractions was to make the max size of each pool undefined by returning -1. It looks as if management.cpp assumes that this is not the case for our memory pools.
                                     
2010-08-26
PUBLIC COMMENTS

The assert failure happens in this method:

// Returns a java/lang/management/MemoryUsage object representing
// the memory usage for the heap or non-heap memory.
JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
  ResourceMark rm(THREAD);

  // Calculate the memory usage
  size_t total_init = 0;
  size_t total_used = 0;
  size_t total_committed = 0;
  size_t total_max = 0;
  bool   has_undefined_init_size = false;
  bool   has_undefined_max_size = false;

  for (int i = 0; i < MemoryService::num_memory_pools(); i++) {
    MemoryPool* pool = MemoryService::get_memory_pool(i);
    if ((heap && pool->is_heap()) || (!heap && pool->is_non_heap())) {
      MemoryUsage u = pool->get_memory_usage();
      total_used += u.used();
      total_committed += u.committed();

      // if any one of the memory pool has undefined init_size or max_size,
      // set it to -1
      if (u.init_size() == (size_t)-1) {
        has_undefined_init_size = true;
      }
      if (!has_undefined_init_size) {
        total_init += u.init_size();
      }

      if (u.max_size() == (size_t)-1) {
        has_undefined_max_size = true;
      }
      if (!has_undefined_max_size) {
        total_max += u.max_size();
      }
    }
  }

  // In our current implementation, all pools should have
  // defined init and max size
  assert(!has_undefined_init_size, "Undefined init size");
>>>>  assert(!has_undefined_max_size, "Undefined max size");  <<<<

  MemoryUsage usage((heap ? InitialHeapSize : total_init),
                    total_used,
                    total_committed,
                    (heap ? Universe::heap()->max_capacity() : total_max));

  Handle obj = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
  return JNIHandles::make_local(env, obj());
JVM_END
                                     
2010-08-26
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/1c63587d925b
                                     
2010-08-28



Hardware and Software, Engineered to Work Together