3 Replies Latest reply: Jun 18, 2008 1:00 PM by 843810 RSS

    Monitoring Threads on JVM

    843810
      Hi,

      We have problem in Live where we notice the error "java.land.OutofMemoryError: unable to create new native thread at java.lang.Thread.start(Native Method)." To investigate the problem i would like to moniter the active threads on JVM.

      Can you please suggest some tool that can be installed on Live and moniter number of active threads on JVM?

      Please let me know if you need any more details.

      Thanks,
      Sudhir
        • 1. Re: Monitoring Threads on JVM
          843810
          Which version of jdk you are using?

          Try jstack tool which is part of jdk. If it is jvm is hung you can use jstack -F <pid>.
          This prints the stack trace of all threads. On 1.5 pre version you can send ctrl-break signal to dump all threads stack trace..
          If you are just interested in threads then filter out stack trace dumped by this tool using shell
          script.
          • 2. Re: Monitoring Threads on JVM
            843810
            Thanks very much for the response JDK verions is 1.4.
            FYI.. the applicaiton is installed on Red Hat Linux OS. Sun Website says that jstack is not currently available on Windows Platform or on Linux platform. wondering if it works.

            Morver i see some other tool dmstool, which gives active.threads at any point of time with the command $ dmstool -JVM. I could see messages like
            activeThreads.maxValue:     88.0     threads
            activeThreads.minValue:     7.0     threads
            activeThreads.value:     88     threads

            but not sure if this is correct.

            Wondering if you helpout on this.

            Also, i see that there are some tools like JProbe from Quest, Optimizeit from Borland and JProfile from EJ which would be use ful for monitering the JVM. But i am not sure if these can be used to monitor on Live environment. .. Please let me know your thought around this.
            Thanks,
            Sudhir
            • 3. Re: Monitoring Threads on JVM
              843810
              1.5 and later version of java has better monitoring tools.
              I have not used jprobe and optimizeit. I think these tools use jvmdi to get threads list
              and it should be ok to monitor threads but better check with them to find out if it is ok to use
              it on live system.
              You can also try the jdb to monitor the threads. It is not realtime. You have to run
              command to get threads. jdb is an experimental/demo tool. Not supported by sun.
              So use it at your risk. If you are just looking at threads then it should not do any
              harm to jvm.