Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8307408

Some jdk/sun/tools/jhsdb tests don't pass test JVM args to the debuggee JVM

    XMLWordPrintable

Details

    • b10

    Backports

      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"));

        Attachments

          Issue Links

            Activity

              People

                cjplummer Chris Plummer
                cjplummer Chris Plummer
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: