question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot run JFR profiler on JDK9/macos

See original GitHub issue

I noticed that I couldn’t self-profile the gradle-profiler build (task help) when running JDK9. JDK8 works fine. I don’t know yet whether this is a JDK/platform issue, or something to do with how gradle-profiler interacts with the profiler/instrumentation.

JDK/platform:

$ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

$ uname -a
Darwin <redacted> 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

Build gradle-profiler then run:

./gradlew installDist
./build/install/gradle-profiler/bin/gradle-profiler --project-dir . --profile jfr --warmups 10 --iterations 10 help

Output:

* Stopping profiler for daemon with pid 73537
Could not load the JFR file.
If the JFR file is compressed, try the decompress option
java.io.FileNotFoundException: /<redacted>/gradle-profiler/profile-out/4.8.jfr (No such file or directory)

Cause in profile-out/profile.log:

* Using args for instrumented builds:

* Starting profiler for daemon with pid 73537
73537:
Could not parse setting /var/folders/k3/pl9l2b3x1sbgzqf_m2n5gfpw0000gn/T/gradle8260768521305363072.jfc

* Running measured build #1 with build tasks [help]

I’ve not yet been able to capture a jfc file or determine any cause. Please advise if any debugging or verbose logging can be added to a run.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
javabrettcommented, Jun 12, 2018

I checked and the .jfc file format seems to have been version-revved for JDK9, there are at least minor schema changes and they are neither forward nor backward compatible. I predict that a different or filtered version of the modified profile config gradle.jfc is going to be needed for JDK8 and 9.

JDK8: <configuration version="1.0" name="Profiling" description="Low overhead configuration for profiling, typically around 2 % overhead." provider="Oracle">

JDK9: <configuration version="2.0" label="Profiling" description="Low overhead configuration for profiling, typically around 2 % overhead." provider="Oracle">

Note version and addition of label at least. I don’t know yet what other schema changes might be in-effect. Testing log below, on macos but same on Linux with Oracle JDK.

$ ./gradlew -Dorg.gradle.jvmargs="-XX:+UnlockCommercialFeatures -XX:+FlightRecorder" help

$ jcmd
1795 org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.8

$ jcmd 1795 JFR.start settings=src/main/resources/org/gradle/profiler/jfr/gradle.jfc
1795:
Could not parse setting src/main/resources/org/gradle/profiler/jfr/gradle.jfc

$ jcmd 1795 JFR.start settings=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/lib/jfr/profile.jfc
1795:
Started recording 1. No limit specified, using maxsize=250MB as default.

Use JFR.dump name=1 filename=FILEPATH to copy recording data to file.
0reactions
oehmecommented, Jun 12, 2018

I made it run on Java 9, though it won’t produce flame graphs yet (see https://github.com/gradle/gradle-profiler/issues/77). That API has changed too 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Troubleshoot Performance Issues Using JFR
First, take a profiling flight recording of your application when it is up and running. Do not include the heap statistics, because that...
Read more >
How do I enable Java Flight Recorder and view the Results
JFR can be activated by configuring JVM options within a Java application at startup or by using the jcmd tool for a running...
Read more >
JFR version 0.9 support - YourKit Java Profiler and .NET ...
The problem is solely in Oracle JDK Java 8. It creates . jfr files of version 0.9 which is incompatible with the JFR...
Read more >
How to use JDK Flight Recorder (JFR)?
Resolution. JDK Flight Recorder (JFR) is a diagnostic and profiling tool for a running Java application. Use one of the three approaches below, ......
Read more >
Hunting down code hotspots with JDK Flight Recorder - BellSoft
JDK Flight Recorder (JFR) and Mission Control (MC) are free and open source performance/profiling products available with OpenJDK 11.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found