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