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

JMXMP connector memory leak

XMLWordPrintable

    • 1.0.1
    • sparc
    • generic

      Test case is provided hereafter.
      Basically, the agent creates a JMXMPConnectorServer and the client loops on connect-close.
      After one night, the agent's size increase from 49M to 111M and ends up with a java.lang.OutOfMemoryError.

      The agent's size before running the client is shown here: ,
      - prstat:
         PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
        3848 root 49M 18M run 59 0 0:00:01 0.8% java/9
      - Output from java -verbose:gc
        [GC 2045K->210K(3520K), 0.0223286 secs]

      The agent's size after one night is:
      - prstat:
        PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
        3848 root 111M 80M run 59 0 1:20:20 0.0% java/9
      - Output from java -verbose:gc
        [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor48]
        65166K->65166K(65344K), 1.0791030 secs]
        java.lang.OutOfMemoryError

      /* ------------------------------------ Agent ------------------------------------ */
      import javax.management.MBeanServer;
      import javax.management.MBeanServerFactory;
      import javax.management.remote.JMXServiceURL;
      import javax.management.remote.jmxmp.JMXMPConnectorServer;
      public class myAgent {
          public static void main(String[] args) {
      MBeanServer mbs = MBeanServerFactory.createMBeanServer();
      if (mbs == null) throw new
      IllegalArgumentException("MBeanServer can't be null");
      try {
      JMXServiceURL jmxu =
      new JMXServiceURL("jmxmp", "localhost", 8082);
      JMXMPConnectorServer scs =
      new JMXMPConnectorServer(jmxu, null, mbs);
      scs.start();
      } catch (Exception e) {
      System.out.println("Exception: " + e);
      }
          }
      }
      /* ------------------------------------ Client ------------------------------------ */
      import java.io.IOException;
      import java.net.MalformedURLException;
      import javax.management.remote.JMXServiceURL;
      import javax.management.remote.JMXConnector;
      import javax.management.remote.JMXConnectorFactory;
      public class Client {
          public static void main(String[] args) {
            while (true) {
              JMXServiceURL jmxu = null;
              try {
                jmxu = new JMXServiceURL("service:jmx:jmxmp://mynode:8082");
              } catch (MalformedURLException e) {
                  System.exit (-1);
              }
              JMXConnector jmxc = null;
              try {
                  jmxc = JMXConnectorFactory.connect(jmxu);
              } catch (IOException e) {
                  System.exit (-1);
              }
              try {
                  jmxc.close ();
              } catch (IOException e) {
                  System.exit (-1);
              }
            }
          }
      }

      ###@###.### 2004-01-20

            sjiang Shanliang Jiang (Inactive)
            fsanseau Frederick Sanseau (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: