Mercurial > hg > release > heapstats-1.0
changeset 48:f2220f6e86b7
Bug 2017: JVM may crash with taking interval SnapShot when concurrent GC is occurred.
reviewed-by: ykubota
author | Yasumasa Suenaga <yasuenag@gmail.com> |
---|---|
date | Fri, 17 Oct 2014 22:29:07 +0900 |
parents | 496fc55ddc32 |
children | 6eca428685f8 |
files | agent/ChangeLog agent/src/oopUtil.cpp agent/src/oopUtil.hpp agent/src/snapShotMain.cpp |
diffstat | 4 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/ChangeLog Fri Aug 22 10:18:27 2014 +0900 +++ b/agent/ChangeLog Fri Oct 17 22:29:07 2014 +0900 @@ -1,3 +1,7 @@ +2014-10-17 KUBOTA Yuji <yasuenag@gmail.com> + + * Bug 2017: JVM may crash with taking interval SnapShot when concurrent GC is occurred. + 2014-08-22 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> * Bump to 1.0.3
--- a/agent/src/oopUtil.cpp Fri Aug 22 10:18:27 2014 +0900 +++ b/agent/src/oopUtil.cpp Fri Oct 17 22:29:07 2014 +0900 @@ -2349,12 +2349,24 @@ } if(useG1){ + if(unlikely(!jvmInfo->isAfterCR7046558())){ /* Heapstats agent is unsupported G1GC on JDK6. */ PRINT_CRIT_MSG("Sorry, G1GC isn't supported in this HotSpot version."); PRINT_CRIT_MSG("You should use >= 22.0-b03"); return false; } + + if(arg.TimerInterval > 0){ + PRINT_WARN_MSG("Interval SnapShot is not supported with G1GC. Turn off."); + arg.TimerInterval = 0; + } + + if(arg.triggerOnDump){ + PRINT_WARN_MSG("SnapShot trigger on dump request is not supported with G1GC. Turn off."); + arg.triggerOnDump = false; + } + } return true;
--- a/agent/src/oopUtil.hpp Fri Aug 22 10:18:27 2014 +0900 +++ b/agent/src/oopUtil.hpp Fri Oct 17 22:29:07 2014 +0900 @@ -190,6 +190,15 @@ extern "C" bool useG1; /*! + * \brief CMS collector state pointer. + * \sa concurrentMarkSweepGeneration.hpp<br> + * at hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/<br> + * enum CollectorState + */ +extern int *CMS_collectorState; + + +/*! * \brief JVM safepoint state pointer. */ extern "C" int *safePointState;
--- a/agent/src/snapShotMain.cpp Fri Aug 22 10:18:27 2014 +0900 +++ b/agent/src/snapShotMain.cpp Fri Oct 17 22:29:07 2014 +0900 @@ -449,6 +449,12 @@ * e.g. GC, DumpRequest or Interval. */ void TakeSnapShot(jvmtiEnv *jvmti, JNIEnv *env, TInvokeCause cause) { + + if(useCMS && (*CMS_collectorState > CMS_IDLING)){ + PRINT_WARN_MSG("CMS GC is working. Skip to take a SnapShot."); + return; + } + /* Count working time. */ static const char *label = "Take SnapShot"; TElapsedTimer elapsedTime(label);