Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903756

jcstress: Skip debugging JVM options for sub-processes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      When jcstress is trying launchingf forked VM, it is passing all its own arguments to it.

      It is easyu what consequences would have passing on also something like:
      ```
      -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
      ```

      I found two occurences:
      ```
      diff --git a/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java b/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java
      index 0d3129a..afe240d 100644
      --- a/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java
      +++ b/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java
      @@ -38,6 +38,7 @@ import java.io.*;
       import java.util.*;
       import java.util.concurrent.*;
       import java.util.concurrent.atomic.AtomicInteger;
      +import java.util.stream.Collectors;
       
       /**
        * Manages test execution for the entire run.
      @@ -279,7 +280,7 @@ public class TestExecutor {
                       command.addAll(OSSupport.getJavaInvokeArguments());
       
                       // jvm args
      - command.addAll(task.jvmArgs);
      + command.addAll(task.jvmArgs.stream().filter(s -> !s.startsWith("-agentlib")).collect(Collectors.toList()));
       
                       if (VMSupport.compilerDirectivesAvailable()) {
                           command.add("-XX:CompilerDirectivesFile=" + compilerDirectives.getAbsolutePath());
      diff --git a/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java b/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java
      index f3025b7..a867925 100644
      --- a/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java
      +++ b/jcstress-core/src/main/java/org/openjdk/jcstress/vm/VMSupport.java
      @@ -461,6 +461,7 @@ public class VMSupport {
       
               for (Config config : configs) {
                   List<String> args = config.origArgs();
      + args = args.stream().filter(s -> !s.startsWith("-agentlib")).collect(Collectors.toList());
                   try {
                       List<String> line = new ArrayList<>(args);
                       line.add(SimpleTestMain.class.getName());
      ```

      Where the case in VMsupport.java is quite straightforward to drop the debugger, in TestExecutor.java I can imagine it may be useful to debug the subprocesses, however the wrapper Should not just copy the debug arg (port clash...) but if this is needed, there may be parameter for jcstress, some `-debugingString` which will append itself to forked vm. If you think this is worthy, I will implement it together with this and https://bugs.openjdk.org/browse/CODETOOLS-7903748


            jvanek Jiří Vaněk
            jvanek Jiří Vaněk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: