changeset 65:ef928edf1d20

Bug 3322: TClassContainer instance might be broken in multithreaded access Reviewed-by: SinTak https://github.com/HeapStats/heapstats/pull/84
author Yasumasa Suenaga <yasuenag@gmail.com>
date Thu, 09 Feb 2017 12:31:27 +0900
parents c5c05ec81fea
children bbf1ae6d2a2e
files agent/ChangeLog agent/src/classContainer.hpp agent/src/snapShotMain.cpp
diffstat 3 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Sun Jan 29 21:49:50 2017 +0900
+++ b/agent/ChangeLog	Thu Feb 09 12:31:27 2017 +0900
@@ -1,3 +1,7 @@
+2017-02-09 Yasumasa Suenaga  <yasuenag@gmail.com>
+
+	* Bug 3322: TClassContainer instance might be broken in multithreaded access
+
 2017-01-24 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
 
 	* Bug 3296: Reference counter should manage TObjectData instance
--- a/agent/src/classContainer.hpp	Sun Jan 29 21:49:50 2017 +0900
+++ b/agent/src/classContainer.hpp	Thu Feb 09 12:31:27 2017 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file classContainer.hpp
  * \brief This file is used to add up using size every class.
- * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2017 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
@@ -147,16 +147,6 @@
         }
 
         /*!
-         * \brief Search class from container without container lock.
-         * \param klassOop [in] Target class oop.
-         * \return Class data of target class.
-         */
-        inline TObjectData *findClassWithoutLock(void *klassOop) {
-          TClassMap::iterator it = classMap->find(klassOop);
-          return (it != classMap->end()) ? it->second : NULL;
-        }
-        
-        /*!
          * \brief Update class oop.
          * \param oldKlassOop [in] Target old class oop.
          * \param newKlassOop [in] Target new class oop.
--- a/agent/src/snapShotMain.cpp	Sun Jan 29 21:49:50 2017 +0900
+++ b/agent/src/snapShotMain.cpp	Thu Feb 09 12:31:27 2017 +0900
@@ -359,7 +359,7 @@
     TObjectData *clsData = NULL;
     
     /* Search child class at local class container. */
-    clsData = aClsContainer->findClassWithoutLock(klassOop);
+    clsData = aClsContainer->findClass(klassOop);
     if (unlikely(clsData == NULL)) {
         
         /* Search child class at root class container. */