From 0be7118b2f761b416ebf8cbb11473d51e80be409 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 6 Nov 2024 16:38:55 +0000 Subject: [PATCH] 8279016: JFR Leak Profiler is broken with Shenandoah Reviewed-by: egahlin, rkennke, mgronlun, wkemper --- make/RunTests.gmk | 4 ++ .../share/jfr/leakprofiler/leakProfiler.cpp | 15 +++++ .../share/jfr/leakprofiler/leakProfiler.hpp | 1 + test/jdk/ProblemList-shenandoah.txt | 60 +++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 test/jdk/ProblemList-shenandoah.txt diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 2d6392d783b..747d8f84dbc 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -856,6 +856,10 @@ define SetupRunJtregTestBody JTREG_AUTO_PROBLEM_LISTS += ProblemList-zgc.txt endif + ifneq ($$(findstring -XX:+UseShenandoahGC, $$(JTREG_ALL_OPTIONS)), ) + JTREG_AUTO_PROBLEM_LISTS += ProblemList-shenandoah.txt + endif + ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), ) # Accept both absolute paths as well as relative to the current test root. $1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$(wildcard \ diff --git a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp index 895eafc4409..cf69dd56934 100644 --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp @@ -34,6 +34,15 @@ #include "runtime/javaThread.inline.hpp" #include "runtime/vmThread.hpp" +bool LeakProfiler::is_supported() { + if (UseShenandoahGC) { + // Leak Profiler uses mark words in the ways that might interfere + // with concurrent GC uses of them. This affects Shenandoah. + return false; + } + return true; +} + bool LeakProfiler::is_running() { return ObjectSampler::is_created(); } @@ -48,6 +57,12 @@ bool LeakProfiler::start(int sample_count) { return false; } + // Exit cleanly if not supported + if (!is_supported()) { + log_trace(jfr, system)("Object sampling is not supported"); + return false; + } + assert(!is_running(), "invariant"); assert(sample_count > 0, "invariant"); diff --git a/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp b/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp index 6290a10ff74..08544f43948 100644 --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp @@ -35,6 +35,7 @@ class LeakProfiler : public AllStatic { static bool start(int sample_count); static bool stop(); static bool is_running(); + static bool is_supported(); static void emit_events(int64_t cutoff_ticks, bool emit_all, bool skip_bfs); static void sample(HeapWord* object, size_t size, JavaThread* thread); diff --git a/test/jdk/ProblemList-shenandoah.txt b/test/jdk/ProblemList-shenandoah.txt new file mode 100644 index 00000000000..063795d69e8 --- /dev/null +++ b/test/jdk/ProblemList-shenandoah.txt @@ -0,0 +1,60 @@ +# +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +############################################################################# +# +# List of quarantined tests for testing with Shenandoah. +# +############################################################################# + +# Quiet all LeakProfiler tests + +jdk/jfr/api/consumer/TestRecordingFileWrite.java 8342951 generic-all +jdk/jfr/event/oldobject/TestAllocationTime.java 8342951 generic-all +jdk/jfr/event/oldobject/TestArrayInformation.java 8342951 generic-all +jdk/jfr/event/oldobject/TestCircularReference.java 8342951 generic-all +jdk/jfr/event/oldobject/TestClassLoaderLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestFieldInformation.java 8342951 generic-all +jdk/jfr/event/oldobject/TestG1.java 8342951 generic-all +jdk/jfr/event/oldobject/TestHeapDeep.java 8342951 generic-all +jdk/jfr/event/oldobject/TestHeapShallow.java 8342951 generic-all +jdk/jfr/event/oldobject/TestLargeRootSet.java 8342951 generic-all +jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java 8342951 generic-all +jdk/jfr/event/oldobject/TestListenerLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestMetadataRetention.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectAge.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectDescription.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectSize.java 8342951 generic-all +jdk/jfr/event/oldobject/TestParallel.java 8342951 generic-all +jdk/jfr/event/oldobject/TestReferenceChainLimit.java 8342951 generic-all +jdk/jfr/event/oldobject/TestSanityDefault.java 8342951 generic-all +jdk/jfr/event/oldobject/TestSerial.java 8342951 generic-all +jdk/jfr/event/oldobject/TestShenandoah.java 8342951 generic-all +jdk/jfr/event/oldobject/TestThreadLocalLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestZ.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdDump.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java 8342951 generic-all +jdk/jfr/jvm/TestWaste.java 8342951 generic-all +jdk/jfr/startupargs/TestOldObjectQueueSize.java 8342951 generic-all +