changeset 248:3c68803ba91b

Bug 3430: Fix potential error when conflict between VMDeath and class loading Reviewed-by: yasuenag https://github.com/HeapStats/heapstats/pull/116
author KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
date Wed, 02 Aug 2017 16:02:28 +0900
parents 33a77b567b62
children d5a88a5981b0
files ChangeLog agent/src/heapstats-engines/snapShotMain.cpp
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Aug 02 14:46:00 2017 +0900
+++ b/ChangeLog	Wed Aug 02 16:02:28 2017 +0900
@@ -1,3 +1,7 @@
+2017-08-02 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
+
+	* Bug 3430: Fix potential error when conflict between VMDeath and class loading
+
 2017-08-02 Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3293: [REFACTORING] Realtime deadlock detector implementation
--- a/agent/src/heapstats-engines/snapShotMain.cpp	Wed Aug 02 14:46:00 2017 +0900
+++ b/agent/src/heapstats-engines/snapShotMain.cpp	Wed Aug 02 16:02:28 2017 +0900
@@ -149,6 +149,7 @@
  */
 void JNICALL
     OnClassPrepare(jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jclass klass) {
+  TProcessMark mark(processing);
 
   /*
    * Wait if VM is at a safepoint which includes safepoint synchronizing,
@@ -285,6 +286,8 @@
  * \param jvmti [in] JVMTI environment object.
  */
 void JNICALL OnGarbageCollectionStart(jvmtiEnv *jvmti) {
+  TProcessMark mark(processing);
+
   snapshotByGC = TSnapShotContainer::getInstance();
 
   /* Enable inner GC event. */
@@ -296,6 +299,8 @@
  * \param jvmti [in] JVMTI environment object.
  */
 void JNICALL OnGarbageCollectionFinish(jvmtiEnv *jvmti) {
+  TProcessMark mark(processing);
+
   /* Disable inner GC event. */
   setupHookForInnerGCEvent(false, NULL);
 
@@ -539,6 +544,8 @@
  * \param jvmti [in] JVMTI environment object.
  */
 void JNICALL OnCMSGCStart(jvmtiEnv *jvmti) {
+  TProcessMark mark(processing);
+
   /* Get CMS state. */
   bool needShapShot = false;
   int cmsState = checkCMSState(gcStart, &needShapShot);
@@ -574,6 +581,8 @@
  * \param jvmti [in] JVMTI environment object.
  */
 void JNICALL OnCMSGCFinish(jvmtiEnv *jvmti) {
+  TProcessMark mark(processing);
+
   /* Disable inner GC event. */
   setupHookForInnerGCEvent(false, NULL);
 
@@ -598,6 +607,8 @@
  * \param jvmti [in] JVMTI environment object.
  */
 void JNICALL OnDataDumpRequestForSnapShot(jvmtiEnv *jvmti) {
+  TProcessMark mark(processing);
+
   /* Avoid the plural simultaneous take snapshot by dump-request.        */
   /* E.g. keeping pushed dump key.                                       */
   /* Because classContainer register a redundancy class in TakeSnapShot. */