Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

JFR version 0.9 support

Moderators: Vladimir Kondratyev, Anton Katilin

JFR version 0.9 support

Postby brunoantunes » Tue Oct 12, 2021 10:52 am

When opening Java Fligth Recording creating using Java SE 8, we get following error:

"File version 0.9. Only Flight Recorder files of version 1.x and 2.x can be read by this JDK"

Using Your Kit Java Profiler 2021.11-b172

regards
--
Bruno Antunes
brunoantunes
 
Posts: 3
Joined: Tue Oct 12, 2021 10:42 am

Re: JFR version 0.9 support

Postby Anton Katilin » Tue Oct 12, 2021 2:23 pm

Hi Bruno,

What is the exact Java version?

Best regards,
Anton
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am

Re: JFR version 0.9 support

Postby Anton Katilin » Tue Oct 12, 2021 2:54 pm

Update:

We would appreciate if you could share an example of such .jfr file. Please zip and send attached to [email protected]
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am

Re: JFR version 0.9 support

Postby brunoantunes » Tue Oct 12, 2021 3:25 pm

I can upload java flight recording, but this can be generated on the fly with any application running, at least with Oracle Java SE 8

Test using Oracle JDK 8 Update 281
# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b32)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b32, mixed mode)

Start some application with this version. An example using "jd-gui"
# java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -jar jd-gui-1.6.6.jar

Perform some recording
# jcmd <PID HERE> JFR.start duration=1m filename=flight.jfr

Try to open generated recording on YourKit and the error will happen.
brunoantunes
 
Posts: 3
Joined: Tue Oct 12, 2021 10:42 am

Re: JFR version 0.9 support

Postby Anton Katilin » Tue Oct 12, 2021 7:16 pm

Thank you for the instructions.

We repeated the steps with OpenJDK Java 8 (not Oracle JDK). The produced JFR file has appropriate supported format.

Please try doing the same with OpenJDK Java 8.

With OpenJDK -XX:+FlightRecorder works without -XX:+UnlockCommercialFeatures too.
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am

Re: JFR version 0.9 support

Postby Anton Katilin » Tue Oct 12, 2021 9:28 pm

It's a problem of the combination Java 8 + Oracle JDK:
- OpenJDK Java 8 is OK;
- Java 11 or newer, either Oracle JDK or OpenJDK, is OK too.
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am

Re: JFR version 0.9 support

Postby brunoantunes » Wed Oct 13, 2021 2:11 pm

We can open that recording in JDK Mission Control (tested with versions 7.1.2, 8 and 8.1) but not on YourKIt.

Tested also executing YourKit with Oracle JDK 11, but the reported error still happens

If we perform execution and recording with OpenJDK 8, Java 11 or newer (Oracle JDK or OpenJDK) YourKIt can read the file.

best regards,
--
Bruno Antunes
brunoantunes
 
Posts: 3
Joined: Tue Oct 12, 2021 10:42 am

Re: JFR version 0.9 support

Postby Anton Katilin » Wed Oct 13, 2021 3:28 pm

Hello Bruno,

The problem is solely in Oracle JDK Java 8. It creates .jfr files of version 0.9 which is incompatible with the JFR API used by YourKit Java Profiler.

The API is the proper, recommended way to deal with .jfr files.

JFR was integrated to Java 11 via https://openjdk.java.net/jeps/328 which encourages to use the API instead of parsing the files directly: "The binary data format is not to be used directly as it is subject to change. Instead, APIs will be provided for interacting with recording files."

The JFR API has been introduced in Java 11. It is available in any Java 11+.

Therefore it does not matter on what JDK you run YourKit Java Profiler. The JFR API is same in OpenJDK and Oracle Java, it is never able to open v0.9 files. It supports versions 1.x and 2.x instead.

Apparently the JMC does not use the API at least for loading v0.9 files. Instead, it must be using an internal implementation for loading this file format.

It seems there is no other way to support the version 0.9 format in YourKit Java Profiler or in any other tool which is not JMC or a derived work than to write a custom parser. We definitely will not be able to fit this task into the upcoming version 2021.11 schedule.

Fortunately, workarounds to this problem exist. If you need Java 8, use OpenJDK instead of Oracle JDK. If you can use Java 11 or newer, there is no problem at all: both Oracle and OpenJDK produce the API-compatible output. So the problem is a legacy of JFR being a closed, commercial feature before Java 11.

Best regards,
Anton
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am

Re: JFR version 0.9 support

Postby dugish1 » Thu Oct 21, 2021 5:36 am

With your permission, we'd like to also ask:
Can we use newer versions beyond java version "1.8.0_281", or do we have a risk it won't work smoothly?
Thanks
dugish1
 
Posts: 1
Joined: Thu Oct 21, 2021 5:29 am

Re: JFR version 0.9 support

Postby Anton Katilin » Thu Oct 21, 2021 1:38 pm

The described difference between Java 8 Oracle JDK and OpenJDK exists in newest Java 8 builds too.
Anton Katilin
 
Posts: 6063
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: No registered users and 1 guest

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.