# HG changeset patch # User Yasumasa Suenaga # Date 1486610837 -32400 # Node ID f6c76c7a8e5645f5c5483a5430963e0e77082882 # Parent 806f47a7d324c64c422bba2e10d3e5b08f883848 Bug 3322: TClassContainer instance might be broken in multithreaded access Reviewed-by: SinTak https://github.com/HeapStats/heapstats/pull/84 diff -r 806f47a7d324 -r f6c76c7a8e56 ChangeLog --- 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 + + * Bug 3322: TClassContainer instance might be broken in multithreaded access + 2017-02-04 Yasumasa Suenaga * Bug 3312: TConfiguration instance should be released at last diff -r 806f47a7d324 -r f6c76c7a8e56 agent/src/heapstats-engines/classContainer.hpp --- 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. diff -r 806f47a7d324 -r f6c76c7a8e56 agent/src/heapstats-engines/snapShotMain.cpp --- 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);