Skip to content
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

Error when trying to use Flight Recorder #180

Closed
MateuszKubuszok opened this issue Jun 10, 2020 · 5 comments
Closed

Error when trying to use Flight Recorder #180

MateuszKubuszok opened this issue Jun 10, 2020 · 5 comments

Comments

@MateuszKubuszok
Copy link

MateuszKubuszok commented Jun 10, 2020

When I try to use Flight Recorder with OpenJDK11 and newest sbt-jmh, I receive this error:

sbt:root> bench/jmh:run -bm avgt -prof jmh.extras.JFR
[info] Packaging /mnt/Workspaces/MateuszKubuszok/test-bench/bench/target/scala-2.12/bench_2.12-0.1.0-SNAPSHOT.jar ...
[info] Done packaging.
[info] Running (fork) org.openjdk.jmh.Main -bm avgt -prof jmh.extras.JFR
[error] WARNING: An illegal reflective access operation has occurred
[error] WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils (file:/tmp/sbt_266d0556/target/44244710/jmh-core-1.21.jar) to field java.io.PrintStream.charOut
[error] WARNING: Please consider reporting this to the maintainers of org.openjdk.jmh.util.Utils
[error] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[error] WARNING: All illegal access operations will be denied in a future release
[info] # JMH version: 1.21
[info] # VM version: JDK 11.0.7, OpenJDK 64-Bit Server VM, 11.0.7+10
[info] # VM invoker: /usr/lib/jvm/java-11-openjdk/bin/java
[info] # VM options: <none>
[info] # Warmup: 5 iterations, 10 s each
[info] # Measurement: 5 iterations, 10 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Average time, time/op
[info] # Benchmark: example.FizzBuzzBenchmark.run
[info] # Run progress: 0.00% complete, ETA 00:08:20
[info] # Fork: 1 of 5
[info] # Preparing profilers: JFR
[info] # Warmup Iteration   1: Error: Could not find or load main class 464690
[info] Caused by: java.lang.ClassNotFoundException: 464690
[info] Error: Could not find or load main class 464690
[info] Caused by: java.lang.ClassNotFoundException: 464690
[info] <failure>
[info] java.lang.RuntimeException: Non zero exit code from: /usr/lib/jvm/java-11-openjdk/bin/java 464690 JFR.start name=JMH-profile-example.FizzBuzzBenchmark.run-warmup settings=profile
[info]  at pl.project13.scala.jmh.extras.profiler.ProfilerUtils.startAndWait(ProfilerUtils.java:40)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.jcmd(FlightRecordingProfiler.java:305)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.startJfr(FlightRecordingProfiler.java:211)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.beforeIteration(FlightRecordingProfiler.java:154)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.startProfilers(BenchmarkHandler.java:261)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.runIteration(BenchmarkHandler.java:334)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:262)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:234)
[info]  at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:139)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmarksForked(BaseRunner.java:76)
[info]  at org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:72)
[info]  at org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:84)
[info] # Run progress: 20.00% complete, ETA 00:00:01
[info] # Fork: 2 of 5
[info] # Preparing profilers: JFR
[info] # Warmup Iteration   1: Error: Could not find or load main class 464748
[info] Caused by: java.lang.ClassNotFoundException: 464748
[info] Error: Could not find or load main class 464748
[info] Caused by: java.lang.ClassNotFoundException: 464748
[info] <failure>
[info] java.lang.RuntimeException: Non zero exit code from: /usr/lib/jvm/java-11-openjdk/bin/java 464748 JFR.start name=JMH-profile-example.FizzBuzzBenchmark.run-warmup settings=profile
[info]  at pl.project13.scala.jmh.extras.profiler.ProfilerUtils.startAndWait(ProfilerUtils.java:40)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.jcmd(FlightRecordingProfiler.java:305)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.startJfr(FlightRecordingProfiler.java:211)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.beforeIteration(FlightRecordingProfiler.java:154)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.startProfilers(BenchmarkHandler.java:261)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.runIteration(BenchmarkHandler.java:334)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:262)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:234)
[info]  at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:139)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmarksForked(BaseRunner.java:76)
[info]  at org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:72)
[info]  at org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:84)
[info] # Run progress: 40.00% complete, ETA 00:00:01
...
[info] # Run progress: 80.00% complete, ETA 00:00:00
[info] # Fork: 5 of 5
[info] # Preparing profilers: JFR
[info] # Warmup Iteration   1: Error: Could not find or load main class 464957
[info] Caused by: java.lang.ClassNotFoundException: 464957
[info] Error: Could not find or load main class 464957
[info] Caused by: java.lang.ClassNotFoundException: 464957
[info] <failure>
[info] java.lang.RuntimeException: Non zero exit code from: /usr/lib/jvm/java-11-openjdk/bin/java 464957 JFR.start name=JMH-profile-example.FizzBuzzBenchmark.run-warmup settings=profile
[info]  at pl.project13.scala.jmh.extras.profiler.ProfilerUtils.startAndWait(ProfilerUtils.java:40)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.jcmd(FlightRecordingProfiler.java:305)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.startJfr(FlightRecordingProfiler.java:211)
[info]  at pl.project13.scala.jmh.extras.profiler.FlightRecordingProfiler.beforeIteration(FlightRecordingProfiler.java:154)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.startProfilers(BenchmarkHandler.java:261)
[info]  at org.openjdk.jmh.runner.BenchmarkHandler.runIteration(BenchmarkHandler.java:334)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:262)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:234)
[info]  at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:139)
[info]  at org.openjdk.jmh.runner.BaseRunner.runBenchmarksForked(BaseRunner.java:76)
[info]  at org.openjdk.jmh.runner.ForkedRunner.run(ForkedRunner.java:72)
[info]  at org.openjdk.jmh.runner.ForkedMain.main(ForkedMain.java:84)
[info] # Run complete. Total time: 00:00:01
[info] REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
[info] why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
[info] experiments, perform baseline and negative tests that provide experimental control, make sure
[info] the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
[info] Do not assume the numbers tell you what you want them to tell.
[info] Benchmark  Mode  Cnt  Score   Error  Units

This is a very simple example test with one @Benchmark that I used to try out Flight Recorder from OpenJDK with OpenJDK11. I get this error when I run:

sbt:root> bench/jmh:run -bm avgt -prof jmh.extras.JFR

If I run benchmarks without Flight Recorder profile

sbt:root> bench/jmh:run -bm avgt

everything works correctly.

It's quite clear from the error message that the arguments passed to java are wrong because main class is missing. Looking at jps during both runs, it seems that org.openjdk.jmh.runner.ForkedMain 127.0.0.1 arguments are dropped for some reason.

Is there some issue with my setup, is is this some bug that I can help fixing?

@ktoso
Copy link
Member

ktoso commented Jun 10, 2020

Hi Mateusz,
I sadly can't currently look into those things; If you can figure it out and submit a PR we could figure out to make a release though.

@MateuszKubuszok
Copy link
Author

I'll give it a shot, though a bit later

@MateuszKubuszok
Copy link
Author

So far I see that I will have to update sbt and plugins because developing on 0.13.x is impossible, I cannot publishLocal without updating things first.

@MateuszKubuszok
Copy link
Author

I found the root cause of my issue, but since I was unable to publish local without updating sbt as well I made this PR bigger than it is necessary, so tell me what you think about it #181

@retronym
Copy link
Member

-prof jfr is no longer part of sbt-jmh, it has been moved to JMH core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants