changeset 219:f6c76c7a8e56

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:27:17 +0900
parents 806f47a7d324
children b2dad9ff2e1b
files ChangeLog agent/src/heapstats-engines/classContainer.hpp agent/src/heapstats-engines/snapShotMain.cpp
diffstat 3 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 04 20:48:20 2017 +0900
+++ b/ChangeLog	Thu Feb 09 12:27:17 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-02-04  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3312: TConfiguration instance should be released at last
--- a/agent/src/heapstats-engines/classContainer.hpp	Sat Feb 04 20:48:20 2017 +0900
+++ b/agent/src/heapstats-engines/classContainer.hpp	Thu Feb 09 12:27:17 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
@@ -142,16 +142,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/heapstats-engines/snapShotMain.cpp	Sat Feb 04 20:48:20 2017 +0900
+++ b/agent/src/heapstats-engines/snapShotMain.cpp	Thu Feb 09 12:27:17 2017 +0900
@@ -335,7 +335,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. */
     clsData = clsContainer->findClass(klassOop);