Skip to content

8364973: Add JVMTI stress testing mode #26360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
74a0751
first version of jvmti stress agent
lmesnik Jul 17, 2025
6cfa190
removed typo
lmesnik Jul 17, 2025
2c2ffd9
Merge branch 'master' of https://github.com/openjdk/jdk into jvmti-st…
lmesnik Jul 17, 2025
4eaae9d
update
lmesnik Jul 18, 2025
9aee241
The more clean up.
lmesnik Jul 19, 2025
ede07c8
fixed phase
lmesnik Jul 19, 2025
9bc7a60
added settings
lmesnik Jul 19, 2025
65a6426
more fixes
lmesnik Jul 19, 2025
d23f2e9
lib updated
lmesnik Jul 21, 2025
014e4e4
updated struct to c++
lmesnik Jul 21, 2025
5f7a1e4
fixed vm death
lmesnik Jul 21, 2025
e891f7a
Merge branch 'master' of https://github.com/openjdk/jdk into jvmti-st…
lmesnik Jul 21, 2025
829af9e
Revert "updated struct to c++"
lmesnik Aug 7, 2025
262aa48
fixed small issues
lmesnik Aug 7, 2025
6badb2c
Merge branch 'master' of https://github.com/openjdk/jdk into jvmti-st…
lmesnik Aug 7, 2025
4c23432
fixed IR framework
lmesnik Aug 7, 2025
cb9c645
problemlist and exclusion fiexd.
lmesnik Aug 7, 2025
6d505a8
makefiles fixed
lmesnik Aug 7, 2025
49c2a67
fixed makefiles
lmesnik Aug 10, 2025
9923132
renamed functions, removed incorrect comments
lmesnik Aug 14, 2025
0058e51
removed wrong commit.
lmesnik Aug 14, 2025
360db5d
removed space
lmesnik Aug 14, 2025
8d03d29
Update test/lib/jdk/test/lib/jvmti/libJvmtiStressAgent.cpp
lmesnik Aug 14, 2025
68397a7
Update test/lib/jdk/test/lib/jvmti/libJvmtiStressAgent.cpp
lmesnik Aug 14, 2025
d45c070
Apply suggestions from code review
lmesnik Aug 14, 2025
514ed25
add documentation
lmesnik Aug 15, 2025
0dc79e0
initialization of array fixed
lmesnik Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ $(eval $(call SetTestOpt,AOT_JDK,JTREG))

$(eval $(call ParseKeywordVariable, JTREG, \
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
TEST_MODE ASSERT VERBOSE RETAIN TEST_THREAD_FACTORY MAX_MEM RUN_PROBLEM_LISTS \
RETRY_COUNT REPEAT_COUNT MAX_OUTPUT REPORT AOT_JDK $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
TEST_MODE ASSERT VERBOSE RETAIN TEST_THREAD_FACTORY JVMTI_STRESS_AGENT \
MAX_MEM RUN_PROBLEM_LISTS RETRY_COUNT REPEAT_COUNT MAX_OUTPUT REPORT \
AOT_JDK $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS \
$(CUSTOM_JTREG_STRING_KEYWORDS), \
Expand Down Expand Up @@ -876,6 +877,15 @@ define SetupRunJtregTestBody
))
endif

ifneq ($$(JTREG_JVMTI_STRESS_AGENT), )
AGENT := $$(LIBRARY_PREFIX)JvmtiStressAgent$$(SHARED_LIBRARY_SUFFIX)=$$(JTREG_JVMTI_STRESS_AGENT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the usage scenario here. Are you supposed to run this like make test JTREG=JVMTI_STRESS_AGENT=true? If so, this will result in -javaoption:'-agentpath:<test-image>/hotspot/jtreg/native/libJvmtiStressAgent.so=true being sent to jtreg, and that looks sus.

Or how should this be used?

In fact, this option should be described in testing.md.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a jtreg agent options, I use it like
JTREG_JVMTI_STRESS_AGENT=debugger=false
or
JTREG_JVMTI_STRESS_AGENT=debugger=true,verbose
Any of options enable jvmti agent and parsed by it.
I don't want to add 2 options, for hits. The JTREG_JVMTI_STRESS_AGENT=false doesn't make any sense.

The options are defined by stress agent while makefile just propagate them to the agent.

$1_JTREG_BASIC_OPTIONS += -javaoption:'-agentpath:${TEST_IMAGE_DIR}/hotspot/jtreg/native/$${AGENT}'
$1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$(wildcard \
$$(addprefix $$($1_TEST_ROOT)/, ProblemList-jvmti-stress-agent.txt) \
))
endif


ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
$1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
endif
Expand Down
16 changes: 16 additions & 0 deletions make/RunTestsPrebuiltSpec.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,19 @@ ULIMIT := ulimit
ifeq ($(OPENJDK_BUILD_OS), windows)
PATHTOOL := cygpath
endif

# These settings are needed to run testing with jvmti agent
ifeq ($(OPENJDK_BUILD_OS), linux)
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .so
endif

ifeq ($(OPENJDK_BUILD_OS), windows)
LIBRARY_PREFIX :=
SHARED_LIBRARY_SUFFIX := .dll
endif

ifeq ($(OPENJDK_BUILD_OS), macosx)
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .dylib
endif
101 changes: 101 additions & 0 deletions test/hotspot/jtreg/ProblemList-jvmti-stress-agent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#
# Copyright (c) 2025, Oracle and/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 failing with jvmti stress agent in any mode.
#
#############################################################################


compiler/macronodes/TestTopInMacroElimination.java 8362832 generic-all

gc/stringdedup/TestStringDeduplicationAgeThreshold.java 8362562 generic-all
gc/stringdedup/TestStringDeduplicationInterned.java 8362562 generic-all
gc/stringdedup/TestStringDeduplicationPrintOptions.java 8362562 generic-all


serviceability/jvmti/events/SingleStep/singlestep02/singlestep02.java 8362350 generic-all
vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/TestDescription.java 8362350 generic-all

# Incompatbile tests

# IR
compiler/loopopts/superword/TestDependencyOffsets.java#avx1-v016-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx1-v016-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx1-v032-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx1-v032-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx2-v016-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx2-v016-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx2-v032-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#avx2-v032-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v004-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v004-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v008-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v008-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v016-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#sse4-v016-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vanilla-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vanilla-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v004-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v004-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v008-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v008-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v016-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v016-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v032-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v032-U 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v064-A 0000000 generic-all
compiler/loopopts/superword/TestDependencyOffsets.java#vec-v064-U 0000000 generic-all

# Requires solo jvmti capabilities

compiler/jvmci/events/JvmciShutdownEventTest.java 0000000 generic-all

# jdwp
runtime/6294277/SourceDebugExtension.java 0000000 generic-all

# heap stats
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorArrayAllSampledTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorEventOnOffTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCParallelTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCSerialTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorIllegalArgumentTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorInitialAllocationTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorInterpreterArrayTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorInterpreterObjectTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorMultiArrayTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorNoCapabilityTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorRecursiveTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatArrayCorrectnessTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatIntervalTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatObjectCorrectnessTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatSimpleTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadDisabledTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadOnOffTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTwoAgentsTest.java 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorVMEventsTest.java#id0 0000000 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorVMEventsTest.java#id1 0000000 generic-all
13 changes: 13 additions & 0 deletions test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import jdk.test.lib.Utils;
import jdk.test.lib.helpers.ClassFileInstaller;
import jdk.test.whitebox.WhiteBox;
import jtreg.SkippedException;

import java.io.PrintWriter;
import java.io.StringWriter;
Expand Down Expand Up @@ -349,6 +350,7 @@ public void start() {
if (shouldInstallWhiteBox()) {
installWhiteBox();
}
checkCompatibleFlags();
checkIRRuleCompilePhasesFormat();
disableIRVerificationIfNotFeasible();

Expand Down Expand Up @@ -775,12 +777,23 @@ private boolean hasIRAnnotations() {
return Arrays.stream(testClass.getDeclaredMethods()).anyMatch(m -> m.getAnnotationsByType(IR.class).length > 0);
}

private void checkCompatibleFlags() {
for (String flag : Utils.getTestJavaOpts()) {
if (flag.contains("-agentpath")) {
throw new SkippedException("Can't run test with agent.");
}
}
}

private List<String> anyNonWhitelistedJTregVMAndJavaOptsFlags() {
List<String> flags = Arrays.stream(Utils.getTestJavaOpts())
.map(s -> s.replaceFirst("-XX:[+|-]?|-(?=[^D|^e])", ""))
.collect(Collectors.toList());
List<String> nonWhiteListedFlags = new ArrayList();
for (String flag : flags) {
if (flag.contains("agentpath")) {
throw new SkippedException("Can't run test with -javaagent");
}
// Property flags (prefix -D), -ea and -esa are whitelisted.
if (!flag.startsWith("-D") && !flag.startsWith("-e") && JTREG_WHITELIST_FLAGS.stream().noneMatch(flag::contains)) {
// Found VM flag that is not whitelisted
Expand Down
47 changes: 47 additions & 0 deletions test/jdk/ProblemList-jvmti-stress-agent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Copyright (c) 2025, Oracle and/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 failing with jvmti stress agent in any mode.
#
#############################################################################


sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java 8362658 generic-all
sun/security/ssl/SSLSessionImpl/MultiNSTClient.java 8362658 generic-all
sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java 8362658 generic-all
sun/security/ssl/SSLSessionImpl/MultiNSTParallel.java 8362658 generic-all
sun/security/ssl/SSLSessionImpl/MultiNSTSequence.java 8362658 generic-all
sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java 8362658 generic-all
sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java 8362658 generic-all


# List of tests incompatible with jvmti stress agent or requiring more investigation

com/sun/jdi/EATests.java#id0 0000000 generic-all
com/sun/jdi/ThreadMemoryLeakTest.java 0000000 generic-all

# weak referenced are not cleared
java/lang/WeakPairMap/Driver.java 0000000 generic-all
java/lang/ref/ReachabilityFenceTest.java 0000000 generic-all
7 changes: 6 additions & 1 deletion test/jtreg-ext/requires/VMProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,12 @@ protected String vmHasDTrace() {
* @return true if CDS is supported by the VM to be tested.
*/
protected String vmCDS() {
return "" + WB.isCDSIncluded();
boolean noJvmtiAdded = allFlags()
.filter(s -> s.startsWith("-agentpath"))
.findAny()
.isEmpty();

return "" + (noJvmtiAdded && WB.isCDSIncluded());
}

/**
Expand Down
Loading