changeset 137:ef19ed367737

Bug 2817: Incorrect thread name in deadlock alert SNMP trap. Reviewed-by: ykubota GitHub: https://github.com/HeapStats/heapstats/pull/5
author Yasumasa Suenaga <yasuenag@gmail.com>
date Fri, 29 Jan 2016 00:21:54 +0900
parents 65bb27a1c262
children 9cd4715a15aa
files ChangeLog agent/src/heapstats-engines/deadlockFinder.cpp agent/src/heapstats-engines/deadlockFinder.hpp
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 23 22:04:41 2016 +0900
+++ b/ChangeLog	Fri Jan 29 00:21:54 2016 +0900
@@ -1,3 +1,7 @@
+2016-01-29  Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 2817: Incorrect thread name in deadlock alert SNMP trap.
+
 2016-01-23  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 2795:  [REFACTORING] Aggregate static variables for SNMP to trapSender.*
--- a/agent/src/heapstats-engines/deadlockFinder.cpp	Sat Jan 23 22:04:41 2016 +0900
+++ b/agent/src/heapstats-engines/deadlockFinder.cpp	Fri Jan 29 00:21:54 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file deadlockFinder.cpp
  * \brief This file is used by find deadlock.
- * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2016 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
@@ -260,7 +260,7 @@
   TMSecTime nowTime = (TMSecTime)getNowTimeSec();
 
   if (conf->SnmpSend()->get()) {
-    TDeadlockFinder::inst->sendSNMPTrap(nowTime, threadCnt);
+    TDeadlockFinder::inst->sendSNMPTrap(nowTime, threadCnt, threadName);
   }
 
   if (conf->TriggerOnLogLock()->get()) {
@@ -425,8 +425,10 @@
  * \brief Send SNMP trap which contains deadlock information.
  * \param nowTime The time of deadlock occurred.
  * \param threadCnt Number of threads which are related to deadlock.
+ * \param name Thread name of deadlock occurred.
  */
-void TDeadlockFinder::sendSNMPTrap(TMSecTime nowTime, int threadCnt) {
+void TDeadlockFinder::sendSNMPTrap(TMSecTime nowTime,
+                                        int threadCnt, const char *name) {
   /* Trap OID. */
   char trapOID[50] = OID_DEADLOCKALERT;
   oid OID_ALERT_DATE[] = {SNMP_OID_HEAPALERT, 1};
@@ -456,7 +458,7 @@
                     SNMP_VAR_TYPE_COUNTER32);
 
     /* Set thread name. */
-    sender.addValue(OID_DEAD_NAME, OID_LENGTH(OID_DEAD_NAME), threadName,
+    sender.addValue(OID_DEAD_NAME, OID_LENGTH(OID_DEAD_NAME), name,
                     SNMP_VAR_TYPE_STRING);
 
     /* Send trap. */
--- a/agent/src/heapstats-engines/deadlockFinder.hpp	Sat Jan 23 22:04:41 2016 +0900
+++ b/agent/src/heapstats-engines/deadlockFinder.hpp	Fri Jan 29 00:21:54 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file deadlockFinder.hpp
  * \brief This file is used by find deadlock.
- * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2016 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
@@ -148,8 +148,9 @@
    * \brief Send SNMP trap which contains deadlock information.
    * \param nowTime The time of deadlock occurred.
    * \param threadCnt Number of threads which are related to deadlock.
+   * \param name Thread name of deadlock occurred.
    */
-  void sendSNMPTrap(TMSecTime nowTime, int threadCnt);
+  void sendSNMPTrap(TMSecTime nowTime, int threadCnt, const char *name);
 
   /*!
    * \brief Check deadlock.