changeset 13:87dbb2865c68

Bug 1505: [REOPEN] Suppress warning when dead lock detection faild. reviewed-by: ykubota
author Yasumasa Suenaga <suenaga.yasumasa@lab.ntt.co.jp>
date Fri, 31 Jan 2014 11:40:52 +0900
parents 87dc27ccb8b0
children 229309c835e7
files agent/ChangeLog agent/src/deadlockFinder.cpp
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Wed Jan 15 10:10:35 2014 +0900
+++ b/agent/ChangeLog	Fri Jan 31 11:40:52 2014 +0900
@@ -1,3 +1,7 @@
+2014-01-31  Yasumasa Suenaga  <suenaga.yasumasa@lab.ntt.co.jp>
+
+	* Bug 1505: [REOPEN] Suppress warning when dead lock detection faild.
+
 2014-01-15  Yasumasa Suenaga  <suenaga.yasumasa@lab.ntt.co.jp>
 
 	* Bug 1644: Can't hook FullGC when G1 Evacuation Failure occurs.
--- a/agent/src/deadlockFinder.cpp	Wed Jan 15 10:10:35 2014 +0900
+++ b/agent/src/deadlockFinder.cpp	Fri Jan 31 11:40:52 2014 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file deadlockFinder.cpp
  * \brief This file is used by find deadlock.
- * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -319,8 +319,14 @@
         void *thisThreadPtr = get_this_thread();
         void *thread_lock = *(void**)threads_lock;
         if (unlikely(thisThreadPtr == NULL || thread_lock == NULL)) {
-            PRINT_DEBUG_MSG("Deadlock detection failed: Lock owner not found.");
-            return 0;
+          /*
+           * Thread class in JVM and thread lock should be set.
+           * TDeadlockFinder::checkDeadlock() is called by MonitorContendedEnter
+           * JVMTI event. If this event is fired, current (this) thread must be
+           * live.
+           */
+          PRINT_WARN_MSG("Deadlock detection failed: Cannot get current thread info.");
+          return 0;
         }
         
         /* Get self thread id. */
@@ -594,7 +600,7 @@
         
         if (unlikely(threadPtr == NULL)) {
             /* Shouldn't reach to here. */
-            PRINT_WARN_MSG("Deadlock detection failed!");
+            PRINT_DEBUG_MSG("Deadlock detection failed: Cannot get lock owner thread.");
             flagFailure = true;
             break;
         }
@@ -607,7 +613,8 @@
         threadRec = (TDeadlockList*)malloc(sizeof(TDeadlockList));
         if (unlikely(threadRec == NULL)) {
             /* Shouldn't reach to here. */
-            PRINT_WARN_MSG("Failure allocate deadlock thread list.");
+            PRINT_WARN_MSG(
+              "Deadlock detection failed: Cannot allocate memory for TDeadLockList.");
             flagFailure = true;
             break;
         }
@@ -628,7 +635,7 @@
         
         if (unlikely(nativeThread == NULL)) {
             /* Shouldn't reach to here. */
-            PRINT_WARN_MSG("Deadlock detection failed!");
+            PRINT_DEBUG_MSG("Deadlock detection failed: Cannot get native thread.");
             flagFailure = true;
             break;
         }
@@ -647,7 +654,7 @@
         
         if (unlikely(contendedMonitor == NULL)) {
             /* Shouldn't reach to here. */
-            PRINT_WARN_MSG("Deadlock detection failed!");
+            PRINT_DEBUG_MSG("Deadlock detection failed: Cannot get contended monitor.");
             flagFailure = true;
             break;
         }
@@ -658,7 +665,7 @@
         /* If illegal state. */
         if (unlikely(monitor == NULL)) {
             /* Shouldn't reach to here. */
-            PRINT_WARN_MSG("Deadlock detection failed!");
+            PRINT_DEBUG_MSG("Deadlock detection failed: Cannot get monitor object.");
             flagFailure = true;
             break;
         }