[Swift-commit] r7078 - branches/release-0.94/src/org/griphyn/vdl/karajan

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Mon Sep 16 22:08:32 CDT 2013


Author: hategan
Date: 2013-09-16 22:08:32 -0500 (Mon, 16 Sep 2013)
New Revision: 7078

Modified:
   branches/release-0.94/src/org/griphyn/vdl/karajan/HangChecker.java
Log:
also dump waiting/sleeping/blocked JVM threads if everything else fails (r7077 from trunk)

Modified: branches/release-0.94/src/org/griphyn/vdl/karajan/HangChecker.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/karajan/HangChecker.java	2013-09-17 03:04:38 UTC (rev 7077)
+++ branches/release-0.94/src/org/griphyn/vdl/karajan/HangChecker.java	2013-09-17 03:08:32 UTC (rev 7078)
@@ -93,6 +93,9 @@
                     if (!found) {
                         found = findJVMDeadlocks(ps);
                     }
+                    if (!found) {
+                        dumpJVMThreads(ps);
+                    }
                     logger.warn(os.toString());
                     ps.close();
                     if (found) {
@@ -108,9 +111,26 @@
         }
     }
     
+    private void dumpJVMThreads(PrintStream pw) {
+        ThreadMXBean b = ManagementFactory.getThreadMXBean();
+        if (b != null) {
+            long[] ids = b.getAllThreadIds();
+            if (ids != null && ids.length != 0) {
+                ThreadInfo[] tis = b.getThreadInfo(ids, true, true); 
+                pw.println("\nWaiting JVM threads:");
+                for (ThreadInfo ti : tis) {
+                    Thread.State state = ti.getThreadState();
+                    if (state != Thread.State.RUNNABLE && state != Thread.State.TERMINATED) {
+                        printThreadInfo(pw, ti);
+                    }
+                }
+            }
+        }
+    }
+
     private boolean findJVMDeadlocks(PrintStream pw) {;
-        try {
-            ThreadMXBean b = ManagementFactory.getThreadMXBean();
+        ThreadMXBean b = ManagementFactory.getThreadMXBean();
+        if (b != null) {
             long[] ids = b.findDeadlockedThreads();
             if (ids != null && ids.length != 0) {
                 ThreadInfo[] tis = b.getThreadInfo(ids, true, true); 
@@ -121,9 +141,6 @@
                 return true;
             }
         }
-        catch (Exception e) {
-            logger.warn("Exception caught trying to find JVM deadlocks", e);
-        }
         return false;
     }
 




More information about the Swift-commit mailing list