Minor change in JFR file format

Erik Gahlin erik.gahlin at oracle.com
Thu Dec 8 07:00:38 UTC 2022


Hello,

Sometimes the size of a check point event can be larger than what can fit in an integer (32-bits). Both the JDK and JMC parser read the size field as a compressed long, but casts it to an int. In JMC, see SeekableInputStream:

int CompressedIntsDataInput::readInt() throws IOException {
  return (int) readCompressedLong();
}

ChunkLoaderV1::readConstantPoolEvent(...)

Today:
input.readInt(); // size

Should be changed to:
input.readLong(); // size

We are considering bumping the minor version (a non-breaking change) of the file format, but we are not sure if it is necessary as it was already treated as a long value by the JMC parser?

It's more of a problem for the JDK parser, it checks that the number of bytes read matches that of the event size, but since it is already broken for large check point events, a change will not make it more broken. See this JDK bug for details:
https://bugs.openjdk.org/browse/JDK-8298129

This change will not impact the size of ordinary events.

Erik
[https://opengraph.githubassets.com/5bce3a4387800bd74848b1e763ac6ab97f987eba35c7583bb37c8a666782fe3c/openjdk/jmc]<https://github.com/openjdk/jmc/blob/68387c5bd454fcf4bdda07d0cbe8d6eb59e2a840/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/internal/parser/v1/ChunkLoaderV1.java#L103>
jmc/ChunkLoaderV1.java at 68387c5bd454fcf4bdda07d0cbe8d6eb59e2a840 · openjdk/jmc<https://github.com/openjdk/jmc/blob/68387c5bd454fcf4bdda07d0cbe8d6eb59e2a840/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/internal/parser/v1/ChunkLoaderV1.java#L103>
Repository for OpenJDK Mission Control, a production time profiling and diagnostics tools suite. https://openjdk.org/projects/jmc - jmc/ChunkLoaderV1.java at 68387c5bd454fcf4bdda07d0cbe8d6eb59e2a84...
github.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jmc-dev/attachments/20221208/12a88fd5/attachment-0001.htm>


More information about the jmc-dev mailing list