changeset 42:6dd54555d3bb

Bug 2378: JVM may crashe when class unload is occurred. reviewed-by: ykubota
author Yasumasa Suenaga <yasuenag@gmail.com>
date Sun, 24 May 2015 18:32:48 +0900
parents 0c499e72a72d
children 02af7ec6063e
files agent/ChangeLog agent/src/classContainer.cpp agent/src/classContainer.hpp agent/src/snapShotProcessor.cpp
diffstat 4 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ChangeLog	Fri May 22 11:59:18 2015 +0900
+++ b/agent/ChangeLog	Sun May 24 18:32:48 2015 +0900
@@ -1,3 +1,7 @@
+2015-05-24 Yasumasa Suenaga  <yasuenag@gmail.com>
+
+	* Bug 2378: JVM may crashe when class unload is occurred.
+
 2015-05-22 KUBOTA Yuji  <kubota.yuji@lab.ntt.co.jp>
 
 	* Bug 2376: Deadlock finder needs to return a original _thread_state to HotSpot VM.
--- a/agent/src/classContainer.cpp	Fri May 22 11:59:18 2015 +0900
+++ b/agent/src/classContainer.cpp	Sun May 24 18:32:48 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file classContainer.cpp
  * \brief This file is used to add up using size every class.
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 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
@@ -998,9 +998,6 @@
         }
     }
     
-    /* Commit class changing. */
-    commitClassChange();
-    
     /* Cleanup. */
     (*rank) = sortArray;
     return raisedErrNum;
--- a/agent/src/classContainer.hpp	Fri May 22 11:59:18 2015 +0900
+++ b/agent/src/classContainer.hpp	Sun May 24 18:32:48 2015 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file classContainer.hpp
  * \brief This file is used to add up using size every class.
- * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2015 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
@@ -280,10 +280,10 @@
         
         /*!
          * \brief Commit class information changing in class container.<br>
-         *        This function is for avoiding trouble with class map.<br>
-         *        At "afterTakeSnapShot", map is copied as shadow copy.<br>
-         *        So crash JVM,
-         *        if we remove item and output map at the same times.
+         *        This function needs to prevent the crash which is related
+         *        to class unloading. <br>
+         *        Agent have to keep ObjectData structure(s) until dumping
+         *        SnapShot and showing heap ranking.
          */
         virtual void commitClassChange(void);
         
--- a/agent/src/snapShotProcessor.cpp	Fri May 22 11:59:18 2015 +0900
+++ b/agent/src/snapShotProcessor.cpp	Sun May 24 18:32:48 2015 +0900
@@ -146,6 +146,7 @@
             }
             
             /* Clean up. */
+            controller->_container->commitClassChange();
             TSnapShotContainer::releaseInstance(snapshot);
             delete ranking;
             ranking = NULL;