-
Notifications
You must be signed in to change notification settings - Fork 922
Closed
Labels
Description
Describe the bug
JDK built-in JFR reader does not support empty constant pools.
For example, when profiling a non-Java application, jfr print
will not be able to open async-profiler's .jfr recording, because it contains no Java packages:
jfr print: unexpected internal error, Pool jdk.types.Package must contain at least one element
java.lang.InternalError: Pool jdk.types.Package must contain at least one element
at jdk.jfr/jdk.jfr.internal.consumer.ChunkParser.fillConstantPools(ChunkParser.java:357)
at jdk.jfr/jdk.jfr.internal.consumer.ChunkParser.<init>(ChunkParser.java:141)
at jdk.jfr/jdk.jfr.internal.consumer.ChunkParser.<init>(ChunkParser.java:109)
at jdk.jfr/jdk.jfr.internal.consumer.ChunkParser.<init>(ChunkParser.java:105)
at jdk.jfr/jdk.jfr.consumer.RecordingFile.createChunkParser(RecordingFile.java:318)
at jdk.jfr/jdk.jfr.consumer.RecordingFile.findNext(RecordingFile.java:294)
at jdk.jfr/jdk.jfr.consumer.RecordingFile.<init>(RecordingFile.java:89)
at jdk.jfr/jdk.jfr.internal.tool.EventPrintWriter.print(EventPrintWriter.java:74)
at jdk.jfr/jdk.jfr.internal.tool.Print.execute(Print.java:165)
at jdk.jfr/jdk.jfr.internal.tool.Main.main(Main.java:92)
The workaround is to emit a dummy java.lang.String
pool with one empty element.
Expected vs. actual behavior
jfr print
should not fail with an exception.
Reproduction Steps
LD_PRELOAD=libasyncProfiler.so ASPROF_COMMAND=start,event=cpu,interval=10us,file=out.jfr java -version
jfr print out.jfr
Additional Information/Context
See #1075 for a previous attempt to fix the issue.
Async-profiler version
master