# HG changeset patch # User Yasumasa Suenaga # Date 1595130777 -32400 # Node ID 1e8de29f38c4b6cb863896e45521ead4252a7658 # Parent d9111a1d15cf5f01d38541714b5556abbbf9941d Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later Co-authored-by: KUBOTA Yuji Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/154 diff -r d9111a1d15cf -r 1e8de29f38c4 ChangeLog --- a/ChangeLog Mon Nov 11 21:07:11 2019 +0900 +++ b/ChangeLog Sun Jul 19 12:52:57 2020 +0900 @@ -1,3 +1,7 @@ +2020-07-19 Yasumasa Suenaga + + * Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later + 2019-11-11 Yasumasa Suenaga * Bug 3764: Agent thread might not be stopped when it works diff -r d9111a1d15cf -r 1e8de29f38c4 README --- a/README Mon Nov 11 21:07:11 2019 +0900 +++ b/README Sun Jul 19 12:52:57 2020 +0900 @@ -36,6 +36,8 @@ * Linux x64 / x86_64 / AArch32 * Oracle JDK / OpenJDK 6u18 or later +**NOTE: For JDK 8u262 or later, we recommend to use built-in agent, JDK Flight Recorder, instead of HeapStats** + ## How to use ## You can attach HeapStats agent by any way of the following: @@ -154,4 +156,3 @@ # License # [GNU General Public License, version 2](COPYING) - diff -r d9111a1d15cf -r 1e8de29f38c4 agent/src/heapstats-engines/jvmInfo.cpp --- a/agent/src/heapstats-engines/jvmInfo.cpp Mon Nov 11 21:07:11 2019 +0900 +++ b/agent/src/heapstats-engines/jvmInfo.cpp Sun Jul 19 12:52:57 2020 +0900 @@ -1,7 +1,7 @@ /*! * \file jvmInfo.cpp * \brief This file is used to get JVM performance information. - * Copyright (C) 2011-2016 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2020 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 @@ -526,4 +526,18 @@ if (!isAfterJDK9()) { loadDelayLogFlag &= (_endorsedPath != NULL) && (_bootClassPath != NULL); } + + /* JFR-backported JDK 8 is not supported */ +#if USE_PCRE + TPCRERegex versionRegex("^\\d+\\.(\\d+)\\.\\d+_(\\d+)[^0-9]*$", 9); +#else + TCPPRegex versionRegex("^\\d+\\.(\\d+)\\.\\d+_(\\d+)[^0-9]*$"); +#endif + if (versionRegex.find(this->_javaVersion)) { + int major = atoi(versionRegex.group(1)); + int update = atoi(versionRegex.group(2)); + if ((major == 8) && (update >= 262)) { + logger->printWarnMsg("JDK %s is not recommended due to JFR backport", this->_javaVersion); + } + } }