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

Cannot run JFR profiler on JDK9/macos #76

Closed
javabrett opened this issue Jun 11, 2018 · 5 comments
Closed

Cannot run JFR profiler on JDK9/macos #76

javabrett opened this issue Jun 11, 2018 · 5 comments

Comments

@javabrett
Copy link
Contributor

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.

@oehme
Copy link
Contributor

oehme commented Jun 12, 2018

At first I thought you weren't using an Oracle JDK, but it actually is trying to parse the settings file. Odd, I haven't seen that before. Maybe the configuration format changed between JVM releases? Or did the temp file creation not work on your machine?

@javabrett
Copy link
Contributor Author

I think I'll try this again on Linux in case there is macos jvm or tooling foo. Does the profiler project have public builds, where? I guess they run jdk8.

@javabrett
Copy link
Contributor Author

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.

@oehme
Copy link
Contributor

oehme commented Jun 12, 2018

Thanks for checking, that's super helpful! I'll add a config file for Java 9.

@oehme
Copy link
Contributor

oehme commented Jun 12, 2018

I made it run on Java 9, though it won't produce flame graphs yet (see #77). That API has changed too :/

@oehme oehme closed this as completed Jun 12, 2018
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

2 participants