have a try on OpenJ9


OpenJ9 is a JVM. IBM donated it to Eclipse Foundation. it's an only JVM, so we need OpenJDK to use.

Setting up is really easy, but OpenJ9 is for Linux only yet. Download an archive from the website and then unarchive.

Add the directory to PATH.

$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-adhoc.jenkins.openjdk)
Eclipse OpenJ9 VM (build 2.9, JRE 9 Linux amd64-64 Compressed References 20170915_6 (JIT enabled, AOT enabled)
J9VM - cea1ed7
JIT  - cea1ed7
OMR  - 617de12
OpenJDK  - 83f5cd0 based on )

OpenJ9 is different from HotSpot. I'm interested in DDR (Direct Dump Reader). It's a core dump analyzer. I'm not good at using GDB, so it's useful. DDR was included in IBM SDK, it isn't included in OpenJ9 yet. But there is a plan to release DDR in OpenJ9. I heard about DDR in Devoxx 2017. More details are in this slides.


So I tried to use DDR with IBM SDK.

$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build - pxa6480sr5-20170905_01(SR5))
IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64 Compressed References 20170901_363591 (JIT enabled, AOT enabled)
J9VM - d56eb84
JIT - tr.open_20170901_140853_d56eb84
OMR - b033a01)
JCL - 20170823_01 based on Oracle jdk8u144-b01

First, get a core dump file.

$ jps
$ sudo gcore 2999

Second, launch DDR Interactive.

$ cd ibm-java-x86_64-80/jre/lib/ddr/
$ java -cp j9ddr.jar:../ext/dtfj.jar com.ibm.j9ddr.tools.ddrinteractive.DDRInteractive core.2999
*0 : PID: 2999;  !j9javavm 0x7f19c80127c0
Run !j9help to see a list of commands

Finally, we can get information from the core dump.

> threads
    !stack 0x00850200   !j9vmthread 0x00850200  !j9thread 0x7f19c8007fb0    tid 0xbb9 (3001) // (main)
    !stack 0x00853d00   !j9vmthread 0x00853d00  !j9thread 0x7f19c80a9d30    tid 0xbc1 (3009) // (JIT Compilation Thread-0)
    !stack 0x00857900   !j9vmthread 0x00857900  !j9thread 0x7f19c80aa2a8    tid 0xbc2 (3010) // (JIT Compilation Thread-1 Suspended)
    !stack 0x0085b500   !j9vmthread 0x0085b500  !j9thread 0x7f19c80ab240    tid 0xbc3 (3011) // (JIT Compilation Thread-2 Suspended)
    !stack 0x0085f100   !j9vmthread 0x0085f100  !j9thread 0x7f19c80ab7b8    tid 0xbc4 (3012) // (JIT Compilation Thread-3 Suspended)
    !stack 0x00862c00   !j9vmthread 0x00862c00  !j9thread 0x7f19c80ac750    tid 0xbc5 (3013) // (JIT Compilation Thread-4 Suspended)
    !stack 0x00866800   !j9vmthread 0x00866800  !j9thread 0x7f19c80accc8    tid 0xbc6 (3014) // (JIT Compilation Thread-5 Suspended)
    !stack 0x0086a400   !j9vmthread 0x0086a400  !j9thread 0x7f19c80adc60    tid 0xbc7 (3015) // (JIT Compilation Thread-6 Suspended)
    !stack 0x0086e000   !j9vmthread 0x0086e000  !j9thread 0x7f19c80ae1d8    tid 0xbc8 (3016) // (JIT Diagnostic Compilation Thread-7 Suspended)
    !stack 0x00871b00   !j9vmthread 0x00871b00  !j9thread 0x7f19c80cdc60    tid 0xbc9 (3017) // (JIT-SamplerThread)
    !stack 0x00875700   !j9vmthread 0x00875700  !j9thread 0x7f19c80ce1d8    tid 0xbca (3018) // (IProfiler)
    !stack 0x00938b00   !j9vmthread 0x00938b00  !j9thread 0x7f19c8379290    tid 0xbcc (3020) // (Signal Dispatcher)
    !stack 0x00944700   !j9vmthread 0x00944700  !j9thread 0x7f19c8388c00    tid 0xbce (3022) // (Concurrent Mark Helper)
    !stack 0x00948200   !j9vmthread 0x00948200  !j9thread 0x7f19c8389178    tid 0xbcf (3023) // (_jdwp_EventDispatcher)
    !stack 0x0094be00   !j9vmthread 0x0094be00  !j9thread 0x7f19c83902a0    tid 0xbd0 (3024) // (_jdwp_PacketDispatcher)
    !stack 0x00960600   !j9vmthread 0x00960600  !j9thread 0x7f19ac015600    tid 0xbda (3034) // (Attach API wait loop)
    !stack 0x0094fa00   !j9vmthread 0x0094fa00  !j9thread 0x7f19c8390818    tid 0xbdb (3035) // (Finalizer thread)

> stackslots 0x00850200
<850200> *** BEGIN STACK WALK, flags = 00400001 walkThread = 0x0000000000850200 ***
<850200> Initial values: walkSP = 0x000000000091D6E0, PC = 0x0000000000000007, literals = 0x0000000000000018, A0 = 0x000000000091D728, j2iFrame = 0x0000000000000000, ELS = 0x00007F19CDEACAF0, decomp = 0x0000000000000000
<850200> JNI native method frame: bp = 0x000000000091D718, sp = 0x000000000091D6E0, pc = 0x0000000000000007, cp = 0x0000000000000000, arg0EA = 0x000000000091D728, flags = 0x0000000000000003
<850200>  Object pushes starting at 0x000000000091D6E0 for 3 slots
<850200>      Push[0x000000000091D6E0] = 0x00000000E0009B98
<850200>      Push[0x000000000091D6E8] = 0x00000000FFF01450
<850200>      Push[0x000000000091D6F0] = 0x00000000FFF013E8
<850200>  JNI local ref pushes starting at 0x000000000091D720 for 2 slots
<850200>      Lcl-JNI-Ref[0x000000000091D720] = 0x0000000000000000
<850200>      Lcl-JNI-Ref[0x000000000091D728] = 0x00000000FFF03BE8
<850200> Bytecode frame: bp = 0x000000000091D750, sp = 0x000000000091D730, pc = 0x00007F19A800EF94, cp = 0x00000000008EA180, arg0EA = 0x000000000091D750, flags = 0x0000000000000000
<850200>  Method: java/io/PrintStream.print(Ljava/lang/String;)V !j9method 0x00000000008EAC68
<850200>  Bytecode index = 0
Problem running command:

> j9object 0x00000000E0009B98
!J9Object 0x00000000E0009B98 {
      struct J9Class* clazz = !j9class 0x87CA00   // java/lang/Class
      Object flags = 0x0000002A;
      I lockword = 0x00000000 (offset=0) (java/lang/Object) <hidden>
      J vmRef = 0x00000000008EB100 (offset=4) (java/lang/Class)
      Ljava/lang/ClassLoader; classLoader = !fj9object 0xfff00000 (offset=12) (java/lang/Class)
      Ljava/security/ProtectionDomain; protectionDomain = !fj9object 0x0 (offset=16) (java/lang/Class)
      Ljava/lang/String; classNameString = !fj9object 0x0 (offset=20) (java/lang/Class)
      Ljava/lang/Class$AnnotationVars; annotationVars = !fj9object 0x0 (offset=24) (java/lang/Class)
      Ljava/lang/ClassValue$ClassValueMap; classValueMap = !fj9object 0x0 (offset=28) (java/lang/Class)
      Ljava/lang/Class$EnumVars; enumVars = !fj9object 0x0 (offset=32) (java/lang/Class)
      Ljava/lang/J9VMInternals$ClassInitializationLock; initializationLock = !fj9object 0x0 (offset=36) (java/lang/Class)
      Ljava/lang/Object; methodHandleCache = !fj9object 0x0 (offset=40) (java/lang/Class)
      Ljava/lang/Class$ClassRepositoryHolder; classRepoHolder = !fj9object 0x0 (offset=44) (java/lang/Class)
      Ljava/lang/Class$AnnotationCache; annotationCache = !fj9object 0x0 (offset=48) (java/lang/Class)
      Ljava/lang/Class$ReflectCache; reflectCache = !fj9object 0x0 (offset=52) (java/lang/Class)