Cannot run JFR profiler on JDK9/macos
See original GitHub issueI 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:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I checked and the
.jfcfile 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 configgradle.jfcis 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
versionand addition oflabelat 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.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 😕