jstack again

Dmytro Sheyko dmytro_sheyko at hotmail.com
Fri Sep 14 01:19:19 PDT 2012


Hi,

There is some oddity in jstack thread reporting though it's quite cosmetic.
If CMS is used, there is no empty line delimiter between ConcurrentMarkSweepThread and WatcherThread

=====
"VM Thread" prio=10 tid=0x00007fea38139800 nid=0x56c runnable 

"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x00007fea3801f000 nid=0x569 runnable 

"Gang worker#1 (Parallel GC Threads)" prio=10 tid=0x00007fea38021000 nid=0x56a runnable 

"Concurrent Mark-Sweep GC Thread" prio=10 tid=0x00007fea38088800 nid=0x56b runnable 
"VM Periodic Task Thread" prio=10 tid=0x00007fea381cc800 nid=0x574 waiting on condition 
=====

On the other hand if G1 is used, the situation is opposite: there is unnecessary empty line.

=====
"VM Thread" prio=10 tid=0x00007f31a0117000 nid=0x58d runnable 

"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x00007f31a0023800 nid=0x586 runnable 

"Gang worker#1 (Parallel GC Threads)" prio=10 tid=0x00007f31a0025800 nid=0x587 runnable 

"G1 Main Concurrent Mark GC Thread" prio=10 tid=0x00007f31a0045800 nid=0x58b runnable 

"Gang worker#0 (G1 Parallel Marking Threads)" prio=10 tid=0x00007f31a0072800 nid=0x58c runnable 

"G1 Concurrent Refinement Thread#0" prio=10 tid=0x00007f31a002c000 nid=0x58a runnable 

"G1 Concurrent Refinement Thread#1" prio=10 tid=0x00007f31a002a000 nid=0x589 runnable 

"G1 Concurrent Refinement Thread#2" prio=10 tid=0x00007f31a0028000 nid=0x588 runnable 


"VM Periodic Task Thread" prio=10 tid=0x00007f31a01ac000 nid=0x595 waiting on condition 
=====

Following patch fixes the problem:
=====
diff -r 6124ff421829 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp    Thu Sep 06 17:27:33 2012 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp    Thu Sep 13 15:06:42 2012 +0300
@@ -230,6 +230,7 @@
 void ConcurrentMarkSweepThread::print_all_on(outputStream* st) {
   if (_cmst != NULL) {
     _cmst->print_on(st);
+    st->cr();
   }
   if (_collector != NULL) {
     AbstractWorkGang* gang = _collector->conc_workers();
diff -r 6124ff421829 src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp    Thu Sep 06 17:27:33 2012 -0700
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp    Thu Sep 13 15:06:42 2012 +0300
@@ -3456,7 +3456,6 @@
   st->cr();
   _cm->print_worker_threads_on(st);
   _cg1r->print_worker_threads_on(st);
-  st->cr();
 }
 
 void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const {
diff -r 6124ff421829 src/share/vm/runtime/thread.cpp
--- a/src/share/vm/runtime/thread.cpp    Thu Sep 06 17:27:33 2012 -0700
+++ b/src/share/vm/runtime/thread.cpp    Thu Sep 13 15:06:42 2012 +0300
@@ -4223,8 +4223,10 @@
   st->cr();
   Universe::heap()->print_gc_threads_on(st);
   WatcherThread* wt = WatcherThread::watcher_thread();
-  if (wt != NULL) wt->print_on(st);
-  st->cr();
+  if (wt != NULL) {
+    wt->print_on(st);
+    st->cr();
+  }
   CompileBroker::print_compiler_threads_on(st);
   st->flush();
 }
=====

I hope this change can be reviewed and applied together with
7194254 jstack reports wrong thread priorities‏

Please let me know whether test is needed for the issue.

Thanks,
Dmytro

 		 	   		  


More information about the hotspot-dev mailing list