Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4993586

Second MemoryPoolMBean.setUsageThreshold() crashes VM

XMLWordPrintable

    • b40
    • generic
    • generic
    • Verified



      Name: agR10195 Date: 02/12/2004



      The test Test1 gets each memory pool and tests if the pool supports usage
      threshold. If yes, then the test sets usage threshold that is equal to "max"
      value and then "used" value. The second invocation crashes Tiger-b37 debug
      Server and Client VM on all platforms.

      import java.io.*;
      import java.util.*;
      import java.lang.management.*;

      public class Test1 {
          public static void main(String[] argv) {
              List pools = ManagementFactory.getMemoryPoolMBeans();

              for (int i = 0; i < pools.size(); i++) {
                  MemoryPoolMBean pool = (MemoryPoolMBean) pools.get(i);
                  System.out.println(i + " pool " + pool.getName());
                  
                  boolean isSupported = pool.isUsageThresholdSupported();
                  long max = Math.abs(pool.getUsage().getMax());
                  
                  if (!isSupported)
                      continue;

                  System.out.println(" setting " + max);
           pool.setUsageThreshold(max);
                  long used = pool.getUsage().getUsed();
                  System.out.println(" setting " + used);
                  pool.setUsageThreshold(used);
                  System.out.println(" done");
              }
          }
      }

      % ../jdk1.5.0-b37/solaris-sparc/bin/java_g Test1
      0 pool Code Cache
        setting 33554432
        setting 1114944
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/lowMemoryDetector.cpp:263]
      #
      # An unexpected error has been detected by HotSpot Virtual Machine:
      #
      # Internal Error (/BUILD_AREA/jdk1.5.0/hotspot/src/share/vm/services/lowMemoryD
      etector.cpp, 263 [ Patched ]), pid=17003, tid=1
      #
      # Java VM: Java HotSpot(TM) Client VM (1.5.0-beta2-b37-debug mixed mode)
      #
      # Error: assert(!(is_over_high && is_below_low),"Can't be both true")
      # An error report file with more information is saved as hs_err_pid17003.log
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #
      Current thread is 1
      Dumping core ...
      Abort

      % ../jdk1.5.0-b37/solaris-sparc/bin/java -server Test1
      0 pool Code Cache
        setting 33554432
        setting 297728
        done
      1 pool Eden Space
      2 pool Survivor Space 1
      3 pool Survivor Space 2
      4 pool Tenured Gen
        setting 44761088
        setting 0
        done
      5 pool Perm Gen
        setting 67108864
        setting 1499272
        done

      ======================================================================

            mchung Mandy Chung
            gazsunw Gaz Gaz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: