JDK-6885041 : G1: inconsistent thread dump
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-09-23
  • Updated: 2013-09-18
  • Resolved: 2009-11-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u21Fixed 7Fixed hs16Fixed
Related Reports
Relates :  
Description
It looks as if a jstack generated thread dump when G1 is enabled is giving slightly inconsistent information. Here's an e-mail From Frederic Parain outlining the issues:

First issue: some threads are not dumped correctly,
so I cannot parse the output automatically. Here's an example
of the problem (this is the end of a Thread Dump output
generated with jstack):

"Reference Handler" daemon prio=3 tid=0x0920f400 nid=0xb in Object.wait() [0xfac7b000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x774af250> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:502)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
    - locked <0x774af250> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=3 tid=0x09209800 nid=0xa runnable

"G1 concurrent mark GC Thread"
"G1 concurrent refinement GC Threads" prio=3 tid=0x08091000 nid=0x6 runnable prio=3 tid=0x0808fc00 nid=0x5 runnable
"G1 zero-fill GC Thread" prio=3 tid=0x0914c000 nid=0x9 runnable
"VM Periodic Task Thread" prio=3 tid=0x09232800 nid=0x12 waiting on condition


Usually, each thread is dumped with its name between double quotes,
followed on the same line with the fields: prio, tid and nid.
If you look at the output for the G1 threads, the output of
two threads ("G1 concurrent mark GC Thread" and
"G1 concurrent refinement GC Threads") are mixed, which causes
my Thread Dump parser to fail.

The second issue: during a Thread Dump generated by jstack, some
threads are dumped on the VM's output instead of the jstack output,
namely:

"Gang worker#0 (Parallel GC Threads)" prio=3 tid=0x0806d000 nid=0x3 runnable

"Gang worker#1 (Parallel GC Threads)" prio=3 tid=0x0806e400 nid=0x4 runnable

"Concurrent Mark GC Thread" prio=3 tid=0x09129000 nid=0x7 runnable

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/035d2e036a9b
05-10-2009

SUGGESTED FIX Fixed the output to be closer to what the other GCs do. Here's an example of what it looked before the fix: ... "VM Thread" prio=3 tid=0x091e6000 nid=0xe runnable "G1 concurrent mark GC Thread" "G1 concurrent refinement GC Threads" prio=3 tid=0x080c0c00 nid=0xa runnable prio=3 tid=0x080bf800 nid=0x9 runnable prio=3 tid=0x080be000 nid=0x8 runnable prio=3 tid=0x080bcc00 nid=0x7 runnable "G1 zero-fill GC Thread" prio=3 tid=0x0912e800 nid=0xd runnable "VM Periodic Task Thread" prio=3 tid=0x0920cc00 nid=0x16 waiting on condition JNI global references: 1087 This is what it looks after the fix (for the same app / platform / etc.): ... "VM Thread" prio=3 tid=0x091e6000 nid=0xe runnable "Gang worker#0 (Parallel GC Threads)" prio=3 tid=0x08077800 nid=0x3 runnable "Gang worker#1 (Parallel GC Threads)" prio=3 tid=0x08078c00 nid=0x4 runnable "Gang worker#2 (Parallel GC Threads)" prio=3 tid=0x0807a000 nid=0x5 runnable "Gang worker#3 (Parallel GC Threads)" prio=3 tid=0x0807b400 nid=0x6 runnable "G1 Main Concurrent Mark GC Thread" prio=3 tid=0x090eb800 nid=0xb runnable "Gang worker#0 (G1 Parallel Marking Threads)" prio=3 tid=0x0912d400 nid=0xc runnable "G1 Concurrent Refinement Thread#0" prio=3 tid=0x080c0c00 nid=0xa waiting on condition "G1 Concurrent Refinement Thread#1" prio=3 tid=0x080bf400 nid=0x9 runnable "G1 Concurrent Refinement Thread#2" prio=3 tid=0x080be000 nid=0x8 runnable "G1 Concurrent Refinement Thread#3" prio=3 tid=0x080bcc00 nid=0x7 runnable "G1 Concurrent Zero-Fill Thread" prio=3 tid=0x0912e800 nid=0xd runnable "VM Periodic Task Thread" prio=3 tid=0x0920cc00 nid=0x16 waiting on condition JNI global references: 1091 So the fix reformats the output, adds spaces between threads, and also dumps concurrent marking workers. Some of the missing information was due to the fact that the output was not going to the correct outputStream, which the fix resolves too.
28-09-2009

EVALUATION The way we were doing the thread dump was inconsistent to what the other GCs do.
25-09-2009