Integrated: 7568: Support parsing char fields in jfr events
Gunnar Morling
duke at openjdk.java.net
Mon Mar 7 16:01:07 UTC 2022
On Fri, 18 Feb 2022 10:18:33 GMT, Gunnar Morling <duke at openjdk.java.net> wrote:
> Hey @thegreystone, I noticed that JFR events with `char` attributes cannot be loaded into JMC:
>
>
> org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException: Unknown integer type: char
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.ValueReaders$PrimitiveReader.readLong(ValueReaders.java:424)
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.ValueReaders$QuantityReader.read(ValueReaders.java:192)
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.TypeManager$EventTypeEntry.readEvent(TypeManager.java:319)
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.TypeManager.readEvent(TypeManager.java:420)
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.ChunkLoaderV1.call(ChunkLoaderV1.java:92)
> at org.openjdk.jmc.flightrecorder.internal.parser.v1.ChunkLoaderV1.call(ChunkLoaderV1.java:47)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> at java.base/java.lang.Thread.run(Thread.java:833)
>
>
> The code in `ValueReaders::isNumeric` considers `char` to be numeric, causing this to be treated as `long` during parsing later on. With this fix, I can successfully load and examine a recording with such an attribute type using the `RecordingPrinter` (I haven't tried with the JMC UI, as I haven't set up the toolchain required for building it).
>
> If you agree on the fix per se, could you
>
> * log a JMC issue to which I can attribute this fix
> * advice me on how/where to test this change (I didn't find any tests in the `flightrecorder` module)
>
> Thanks!
This pull request has now been integrated.
Changeset: ab2f75d2
Author: Gunnar Morling <gunnar.morling at googlemail.com>
Committer: Marcus Hirt <hirt at openjdk.org>
URL: https://git.openjdk.java.net/jmc/commit/ab2f75d21c72733c43d3f7cb02550fb1c4c69fd6
Stats: 109 lines in 3 files changed: 105 ins; 1 del; 3 mod
7568: Support parsing char fields in jfr events
Reviewed-by: hirt
-------------
PR: https://git.openjdk.java.net/jmc/pull/378
More information about the jmc-dev
mailing list