krzysztofslusarski / continuous-async-profiler

Spring boot library for continuous profiling with async-profiler
Apache License 2.0
30 stars 5 forks source link

Converting jfr to flamegraph results in error #25

Open bonelli opened 1 year ago

bonelli commented 1 year ago

When I use the continuous async profiler the .jfr files are created correctly, but if I try to convert it to a flamegraph with this code:

AsyncProfilerLoader.executeConverter("jfr2flame", lastJfr.getAbsolutePath(), "/tmp/flamegraph.html");

even if the lastJfr path is correct /home/foo/awsome-project/logs/continuous/wall-2023-01-16_21:59:09.jfr it always ends in error with this stack trace:

java.io.IOException: converter failed with exit code 1, stderr: Exception in thread "main" java.io.IOException: Incomplete JFR file
        at one.jfr.JfrReader.<init>(JfrReader.java:81)
        at one.converter.jfr2flame.main(jfr2flame.java:258), stdout: 
        at one.profiler.AsyncProfilerLoader.executeCommand(AsyncProfilerLoader.java:494) ~[ap-loader-2.9-2-all.jar:2.9-2-all]
        at one.profiler.AsyncProfilerLoader.executeConverter(AsyncProfilerLoader.java:418) ~[ap-loader-2.9-2-all.jar:2.9-2-all]
        at foo.bar.AsyncProfilerController.displayLastProfilerFlamechart(AsyncProfilerController.java:65) ~[classes/:na]

I don't understand the problem, I'm using the same AsyncProfilerLoader that has been used to generate the JFR in the first place. Do you manage to use the generated .jfr to produce a flamegraph?

krzysztofslusarski commented 1 year ago

Do you manage to use the generated .jfr to produce a flamegraph?

yes, but I'm using https://github.com/krzysztofslusarski/jvm-profiling-toolkit viewer.

Do you have that error on all JFR files, or just the newest one?

bonelli commented 1 year ago

I have the same error on all JFR files, even the gzipped ones. But what I was trying to achieve is to have in my Spring Boot web application a path to show the current profiler's output, it looks very very similar to what you have in the https://github.com/krzysztofslusarski/jvm-profiling-toolkit so I will give that a try.

marcobehlerjetbrains commented 1 year ago

Tentatively: Having the same issue, but will try and add more information the next couple of days.