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

Lazy query for current JVM args in Runner

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
      jmh

      Description

      Runner.newBenchmarkParams() currently always ManagementFactory.getRuntimeMXBean().getInputArguments() in all modes. It requires ManagementPermission "monitor" in all cases.

      Consider
      java -jar micros-jdk8/target/micros-jdk8-1.0-SNAPSHOT.jar -f 1 -bm ss FileRead [OK]

      java -Djava.security.manager -Djava.security.policy=jmh-security-minimal-runner.policy -jar micros-jdk8/target/micros-jdk8-1.0-SNAPSHOT.jar -f 0 -bm ss FileRead [OK]

      Now if we remove the permission (jmh-security-minimal-runner-noman.policy)

      java -Djava.security.manager -Djava.security.policy=jmh-security-minimal-runner-noman.policy -jar micros-jdk8/target/micros-jdk8-1.0-SNAPSHOT.jar -f 1 -bm ss FileRead
      Exception in thread "main" java.security.AccessControlException: access denied ("java.lang.management.ManagementPermission" "monitor")
      ...

      But in case we pass JVM or benchmark parameters to forked VM (e.g. -jvmArgs ""), getRuntimeMXBean information is not required.

        Attachments

          Activity

            People

            • Assignee:
              dchuyko Dmitry Chuyko
              Reporter:
              dchuyko Dmitry Chuyko
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: