spark

spark

26M Downloads

Support heap dump summary on OpenJ9 or throw a more helpful error

prajaybasu opened this issue ยท 3 comments

commented

HeapDump.java assumes that it is running on a HotSpot based JVM:

When the heapdump heapsummary command is executed on an OpenJ9 based JVM, an exception is thrown:

System Info: Java 15 (Eclipse OpenJ9 VM master-d4cc28f41) Host: Windows 10 10.0 (amd64)
...  
[WARN]: java.lang.RuntimeException: Unable to get heap dump
[WARN]:        at me.lucko.spark.common.heapdump.HeapDumpSummary.createNew(HeapDumpSummary.java:98)
[WARN]:        at me.lucko.spark.common.command.modules.HeapAnalysisModule.lambda$null$0(HeapAnalysisModule.java:73)
[WARN]:        at me.lucko.spark.common.command.modules.HeapAnalysisModule$$Lambda$5802/0x00000000f9c73198.run(Unknown Source)

I don't know how much effort it will be to add OpenJ9 support, but the plugin should detect if it is running on OpenJ9 and appropriately disable the command until heap dump summary support for the .PHD format can be added.

Relevant: eclipse-openj9/openj9#6593

commented

HeapDump.java assumes that it is running on a HotSpot based JVM:

No.. it doesn't. It explicitly has a check for OpenJ9 ๐Ÿ˜›

if (isOpenJ9()) {
Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
Method heapDumpMethod = dumpClass.getMethod("heapDumpToFile", String.class);
heapDumpMethod.invoke(null, outputPathString);

Now.. perhaps that API has changed since, but that's an entirely different issue.

commented

No.. it doesn't. It explicitly has a check for OpenJ9 ๐Ÿ˜›

Ah, I missed that ๐Ÿคฆ

Now.. perhaps that API has changed since, but that's an entirely different issue.

Actually, the heap dump function works just fine. Heap summary does not, however. I should have been more specific.

commented

Ah, right yeah.

Unfortunately OpenJ9 doesn't support the heap summary functionality (afaik) so you are limited to full help dumps only. Nothing I can do about this in spark I'm afraid.