Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which JVM prints out a thread dump like this?

I'm used to see Java thread dumps that look like the following, which is the one that's generated by Sun HotSpot JVMs and their derivatives, such as OpenJDK:

"main" prio=10 tid=0x00007f4020009000 nid=0x538c in Object.wait() [0x00007f402891f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x0000000614ea64e8> (a java.lang.Object)
    at java.lang.Object.wait(Object.java:503)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.join(QueuedThreadPool.java:386)
    - locked <0x0000000614ea64e8> (a java.lang.Object)
    at org.eclipse.jetty.server.Server.join(Server.java:398)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:531)
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:528)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

Now, in assisting other users using my software, I occasionally come across another form of thread dumps like this:

Thread 9255: (state = BLOCKED)
 - sun.reflect.annotation.AnnotationType.getInstance(java.lang.Class) @bci=0, line=63 (Interpreted frame)
 - sun.reflect.annotation.AnnotationParser.parseAnnotation(java.nio.ByteBuffer, sun.reflect.ConstantPool, java.lang.Class, boolean) @bci=94, line=202 (Interpreted frame)
 - sun.reflect.annotation.AnnotationParser.parseAnnotations2(byte[], sun.reflect.ConstantPool, java.lang.Class) @bci=39, line=69 (Compiled frame)
 - sun.reflect.annotation.AnnotationParser.parseAnnotations(byte[], sun.reflect.ConstantPool, java.lang.Class) @bci=11, line=52 (Compiled frame)
 - java.lang.Class.initAnnotationsIfNecessary() @bci=22, line=3070 (Interpreted frame)
 - java.lang.Class.getAnnotation(java.lang.Class) @bci=13, line=3029 (Interpreted frame)
 - com.google.inject.internal.Annotations.isRetainedAtRuntime(java.lang.Class) @bci=3, line=57 (Interpreted frame)
 - com.google.inject.Key.ensureRetainedAtRuntime(java.lang.Class) @bci=1, line=362 (Interpreted frame)
 - com.google.inject.Key.strategyFor(java.lang.annotation.Annotation) @bci=15, line=339 (Interpreted frame)
 - com.google.inject.Key.get(com.google.inject.TypeLiteral, java.lang.annotation.Annotation) @bci=6, line=274 (Interpreted frame)
 - com.google.inject.assistedinject.FactoryProvider2.assistKey(java.lang.reflect.Method, com.google.inject.Key, com.google.inject.internal.Errors) @bci=14, line=522 (Interpreted frame)
 - com.google.inject.assistedinject.FactoryProvider2.<init>(com.google.inject.Key, com.google.inject.assistedinject.BindingCollector) @bci=306, line=235 (Interpreted frame)

As you can see, the format is quite different, and inferior. It does not report on locks it holds on, nor does it report which object it is waiting on.

Does anyone know what family of JavaVMs produce the 2nd style of stack traces? I've never used one myself, and this has been bugging me for a while!

like image 278
Kohsuke Kawaguchi Avatar asked Jul 02 '13 23:07

Kohsuke Kawaguchi


People also ask

What is JVM thread dump?

A thread dump is a snapshot of the state of all the threads of a Java process. The state of each thread is presented with a stack trace, showing the content of a thread's stack. A thread dump is useful for diagnosing problems, as it displays the thread's activity.

Does heap dump contain thread dump?

Heap dump doesn't contain thread information. You should look at thread dump.

Does thread dump stop JVM?

Yes, thread dump and heap dump are stop-the-world operations in JDK 8. HotSpot JVM performs them at the global safepoint. See this and this answers for more information. Save this answer.

What is thread heap dump?

A thread dump is a snapshot of all threads running in the application at a point in time. It contains all the information about each thread in the application such as thread state, thread Id, native Id, thread name, stack trace, and priority.


2 Answers

This is the output of jstack (in the Oracle JDK) when ran with the -F option.

like image 91
Tom Avatar answered Sep 28 '22 13:09

Tom


This style of thread dump looks like result of jstack utility work under Mac OS X. This could be related to features of the Mac OS JVM implementation.

like image 45
Andremoniy Avatar answered Sep 28 '22 15:09

Andremoniy