hanging thread "VM Thread"
Hi,
Our customer runs a Tomcat 4.1 in a JDK 1.4.2 on Windows 2K.
Frequently (once a day) Tomcat seems to hang and the Java process consumed all CPU. We did a thread dump and identified the Thread named "VM Thread" as the cause. Here is the snippet from the thread dump.
"VM Thread" prio=5 tid=0x00897760 nid=0x2284 runnable
The memory of the Java process is at the configured (-Xmx512m) maximum.
- My questions are:
- what is the purpose of this "VM Thread"?
- Is there anything I can do about it or shall I try to update the JDK?
- I tested the JConsole tool but the "VM Thread", the "VM Periodic Task Thread" and the "Suspend Checker Thread" from the Thread dump are not listed there. Why?
Thanks for your help
Michael
[787 byte] By [
docwarea] at [2007-11-26 21:25:20]

# 1
> - what is the purpose of this "VM Thread"?
It is a vm internal thread. One of the use is GC.
> - Is there anything I can do about it or shall I try
> to update the JDK?
May be you should try printing the GC details and
see if the vm is busy running GC.
Tune your application using memory parameter.
See the list of options provided in the link below.
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
If it is taking too long running GC. Tune your application
using the options listed above.
> - I tested the JConsole tool but the "VM Thread", the
> "VM Periodic Task Thread" and the "Suspend Checker
> Thread" from the Thread dump are not listed there.
> Why?
Because it is vm internal thread.
# 3
If vm thread is dead then the vm will be useless.
If the vm thread is busy for several hours then take a stack trace
of a thread and post it here. The thread could be in deadlock
or busy doing GC. GC will not run for several hours. So it could be
some other problem. So best thing would be to find out what vm
thread is doing when it is stuck for several hours.
# 4
That's the only line for the "VM Thread" in the thread dump output.
"VM Thread" prio=5 tid=0x00897760 nid=0x2284 runnable
I don't know how to trace that further.
As I said I have increased the allowed memory for that Java process for that customer. It seems that it has run now for some days without hanging. So it has probably something to do with the memory, GC or the like. If it will hang again I come back with new infos.
Michael
# 5
Did you try using dbx or gdb to get the stack trace.
If you are running this on windows use windows
debugger to get stack trace.
On solaris and linux you can use jstack with -m option to get the
java and native method stack trace.
Play with some of the debugging tools and it will help you
to get the stack trace. Stack trace is very important information
to debug a problem.