# HG changeset patch # User Yasumasa Suenaga # Date 1434719373 -32400 # Node ID d1ee335f73a0c0bb5e15e9e1b5bba735f53cdf91 # Parent fd76f06f8e575c28e4bd1aa8e8d1d39e2833e2f0 Bug 2452: JVM may crash when CMS GC occurs frequently. reviewed-by: ShinTak diff -r fd76f06f8e57 -r d1ee335f73a0 agent/ChangeLog --- a/agent/ChangeLog Thu May 28 17:19:06 2015 +0900 +++ b/agent/ChangeLog Fri Jun 19 22:09:33 2015 +0900 @@ -1,3 +1,7 @@ +2015-06-19 Yasumasa Suenaga + + * Bug 2452: JVM may crash when CMS GC occurs frequently. + 2015-05-28 KUBOTA Yuji * Bump to 1.0.4 diff -r fd76f06f8e57 -r d1ee335f73a0 agent/src/snapShotMain.cpp --- a/agent/src/snapShotMain.cpp Thu May 28 17:19:06 2015 +0900 +++ b/agent/src/snapShotMain.cpp Fri Jun 19 22:09:33 2015 +0900 @@ -450,8 +450,23 @@ */ void TakeSnapShot(jvmtiEnv *jvmti, JNIEnv *env, TInvokeCause cause) { - if(useCMS && (*CMS_collectorState > CMS_IDLING)){ + /* + * Initial Mark is 1st phase in CMS. + * So we can process the SnapShot in SnapShot queue. + */ + if(useCMS && (*CMS_collectorState > CMS_INITIALMARKING)){ PRINT_WARN_MSG("CMS GC is working. Skip to take a SnapShot."); + TSnapShotContainer *snapshot = NULL; + + ENTER_PTHREAD_SECTION(&queueMutex) { + snapshot = snapStockQueue.front(); + snapStockQueue.pop(); + } EXIT_PTHREAD_SECTION(&queueMutex) + + if(likely(snapshot != NULL)){ + TSnapShotContainer::releaseInstance(snapshot); + } + return; }