changeset 31:2fd23c59d3ef

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:46 +0900
parents 57fd757ef0e2
children a4ee61f4ba79
files agent/ChangeLog agent/src/deadlockFinder.cpp
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Wed Jan 15 10:10:31 2014 +0900
+++ b/agent/ChangeLog	Fri Jan 31 11:40:46 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:31 2014 +0900
+++ b/agent/src/deadlockFinder.cpp	Fri Jan 31 11:40:46 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
@@ -318,7 +318,13 @@
     void *thisThreadPtr = get_this_thread();
     void *thread_lock = *(void**)threads_lock;
     if (unlikely(thisThreadPtr == NULL || thread_lock == NULL)) {
-      PRINT_WARN_MSG("Deadlock detection failed!");
+      /*
+       * 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;
     }
     
@@ -577,7 +583,7 @@
     
     if (unlikely(threadPtr == NULL)) {
       /* Shouldn't reach to here. */
-      PRINT_DEBUG_MSG("Deadlock detection failed: Lock owner not found.");
+      PRINT_DEBUG_MSG("Deadlock detection failed: Cannot get lock owner thread.");
       flagFailure = true;
       break;
     }
@@ -589,7 +595,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;
     }
@@ -610,7 +617,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;
     }
@@ -629,7 +636,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;
     }
@@ -639,7 +646,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;
     }