# HG changeset patch # User KUBOTA Yuji # Date 1501657348 -32400 # Node ID 3c68803ba91b3254fabfa74e57eef0dfcf7eb3f5 # Parent 33a77b567b621c499beb0a7fe5948dd902d5d288 Bug 3430: Fix potential error when conflict between VMDeath and class loading Reviewed-by: yasuenag https://github.com/HeapStats/heapstats/pull/116 diff -r 33a77b567b62 -r 3c68803ba91b ChangeLog --- 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 + + * Bug 3430: Fix potential error when conflict between VMDeath and class loading + 2017-08-02 Yasumasa Suenaga * Bug 3293: [REFACTORING] Realtime deadlock detector implementation diff -r 33a77b567b62 -r 3c68803ba91b agent/src/heapstats-engines/snapShotMain.cpp --- 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. */