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

java.lang.InternalError: Pool jdk.types.StackTrace must contain at least one element #17

Open
Annette0127 opened this issue Nov 28, 2023 · 0 comments

Comments

@Annette0127
Copy link

Hi! I'm currently learning how to work with JFR files and I've been trying to use this project to extract stack traces from the "Events" section of JFR files.

I've been experimenting with some JFR files generated by IntelliJ IDEA. I've been following the demo code provided in this project:

Path jfrFile = ...; // path to some-recording.jfr

Properties properties = new Properties();
properties.put("model", JfrSchemaFactory.INLINE_MODEL.formatted(jfrFile));

try (Connection connection = DriverManager.getConnection("jdbc:calcite:", properties)) {
    PreparedStatement statement = connection.prepareStatement("""
            SELECT TRUNCATE_STACKTRACE("stackTrace", 40), SUM("weight")
            FROM "JFR"."jdk.ObjectAllocationSample"
            GROUP BY TRUNCATE_STACKTRACE("stackTrace", 40)
            ORDER BY SUM("weight") DESC
            LIMIT 10
            """);

    try (ResultSet rs = statement.executeQuery()) {
        while (rs.next()) {
            System.out.println("Trace : " + rs.getString(1));
            System.out.println("Weight: " + rs.getLong(2));
        }
    }
}

but I've encountered a problem that seems a bit beyond my current level of understanding. And the issue looks like this:

Exception in thread "main" java.lang.InternalError: Pool jdk.types.StackTrace 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.nextChunkParser(ChunkParser.java:150)
	at jdk.jfr/jdk.jfr.internal.consumer.EventFileStream.process(EventFileStream.java:111)
	at jdk.jfr/jdk.jfr.internal.consumer.AbstractEventStream.execute(AbstractEventStream.java:261)
	at jdk.jfr/jdk.jfr.internal.consumer.AbstractEventStream$1.run(AbstractEventStream.java:284)
	at jdk.jfr/jdk.jfr.internal.consumer.AbstractEventStream$1.run(AbstractEventStream.java:281)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at jdk.jfr/jdk.jfr.internal.consumer.AbstractEventStream.run(AbstractEventStream.java:281)
	at jdk.jfr/jdk.jfr.internal.consumer.AbstractEventStream.start(AbstractEventStream.java:232)
	at jdk.jfr/jdk.jfr.internal.consumer.EventFileStream.start(EventFileStream.java:56)
	at org.moditect.jfranalytics.JfrSchema.getTableTypes(JfrSchema.java:98)
	at org.moditect.jfranalytics.JfrSchema.<init>(JfrSchema.java:62)
	at org.moditect.jfranalytics.JfrSchemaFactory.create(JfrSchemaFactory.java:65)
	at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:272)
	at org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:66)
	at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:200)
	at org.apache.calcite.model.ModelHandler.<init>(ModelHandler.java:106)
	at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:101)
	at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:139)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)
	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:191)
	at Main.main(Main.java:17)

This exception also occurs when I use the ./jfr print command. For context, I'm using macOS Ventura and Java 21. And it seems while parsing the "constant pool" or "N checkpoint events" (according to the bloc) part, there must be at least one constant. Since IntelliJ IDEA produced the file and is able to parse it correctly, I think the file itself should be fine.

I'm reaching out in the hopes that you might be able to offer some guidance or suggest a workaround that could help me resolve this issue. I would deeply appreciate any insights or suggestions. Thank you so much in advance for your time!😊

An example JFR file that can trigger such an exception:
AssertAllAssertionsTests_2023_11_27_102129.jfr.zip

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

1 participant