JDK-8307408 : Some jdk/sun/tools/jhsdb tests don't pass test JVM args to the debuggee JVM
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-05-03
  • Updated: 2024-10-05
  • Resolved: 2023-08-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 21 JDK 22
17.0.14Fixed 21.0.3Fixed 22 b10Fixed
Related Reports
Relates :  
Relates :  
Description
The JStackStressTest.java, JShellHeapDumpTest, and HeapDumpTestWithActiveProcess launch the target JVM without any arguments. The end result is that we don't always get the testing we expect. For example, proper SA testing is heavily depending on the GC of the targetVM, but it will always end up being the default GC (G1). So when you run a test with -XX:+UseZGC, the test will be run with ZGC, jhsdb will be run with ZGC, but the JVM that jhsdb is debugging will use G1, and it is in fact the debuggee that we really want running with ZGC. We don't care so much about what GC is used for the test and jhsdb.

Using JStackStressTest.java as an example, we can see the problem here:

            ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jshell"));
            jShellProcess = ProcessTools.startProcess("JShell", pb);

We should be using the JDKToolLauncher class. A working example can be found in ClhsdbLauncher.java:

        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
        launcher.addVMArgs(Utils.getTestJavaOpts());
        launcher.addToolArg("clhsdb");
        launcher.addToolArg("--core=" + coreFileName);
        launcher.addToolArg("--exe=" + JDKToolFinder.getTestJDKTool("java"));
        ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());

I think what will work for JStackStressTest.java is (this is completely untested):

            JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jshell");
            launcher.addVMArgs(Utils.getTestJavaOpts());
            ProcessBuilder pb = new ProcessBuilder(launcher.getCommand());
            jShellProcess = ProcessTools.startProcess("JShell", pb);

This will get -XX:+UseZGC passed to the debuggee process. Note if there are any options we want filtered out, we can do something like the following:

            launcher.addVMArgs(Utils.getFilteredTestJavaOpts("-Xcomp"));

Comments
Fix request [17u] I backport this to improve testing in 17. No risk, only a test change. I had to resolve, probably clean anyways. Tests pass. SAP nightly testing passed.
05-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2938 Date: 2024-10-04 10:59:04 +0000
04-10-2024

Fix request [21u] I backport this to keep the 21u test suite up-to-date. This will simplify future test backports. No risk, only a test change. Clean backport. Tests pass. SAP nightly testing passed.
20-12-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/73 Date: 2023-12-19 16:30:40 +0000
19-12-2023

Changeset: 87b08b6e Author: Chris Plummer <cjplummer@openjdk.org> Date: 2023-08-07 18:51:29 +0000 URL: https://git.openjdk.org/jdk/commit/87b08b6e0192d88025c2275c7dd2c4bdecda58e8
07-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15168 Date: 2023-08-04 22:41:43 +0000
04-08-2023

Deferring to 22. This could introduce some testing instability, which I don't want to risk just before RDP1.
01-06-2023

Since SA ZGC support is not very stable, this could possibly result in some new failures when running with ZGC. The failing tests should be problem listed in that case.
03-05-2023