http://mail.openjdk.java.net/pipermail/serviceability-dev/2017-August/021770.html
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/oopmap/
- How to reproduce
1. Start JShell
2. Attach HSDB to jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider
$ jhsdb hsdb --pid <PID of JShellToolProvider>
3. Choose "output reader" thread on Java Threads window
4. Click "Stack Memory" icon on "Java Threads" toolbar.
- Stack trace
```
Error while performing oopsDo for frame sp: 0x00007f80986cb630, unextendedSP: 0x00007f80986cb630, fp: null, pc: 0x00007f80c32edfeb
sun.jvm.hotspot.oops.UnknownOopException
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ObjectHeap.newOop(ObjectHeap.java:264)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.addAnnotation(HSDB.java:1098)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.visitAddress(HSDB.java:1045)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet$MyVisitor.visitOopLocation(ImmutableOopMapSet.java:58)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet.allDo(ImmutableOopMapSet.java:230)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet.oopsDo(ImmutableOopMapSet.java:179)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsCodeBlobDo(Frame.java:618)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsDo(Frame.java:444)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34.run(HSDB.java:1038)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.WorkerThread$MainLoop.run(WorkerThread.java:70)
at java.base/java.lang.Thread.run(Thread.java:844)
```
According to frame::oopmapreg_to_location(), Frame#oopMapRegToLocation() should be calculated with "VMRegImpl::stack_slot_size". Not address size.
I saw similar exception and call stack at reverse pointer calculation.
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/oopmap/
- How to reproduce
1. Start JShell
2. Attach HSDB to jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider
$ jhsdb hsdb --pid <PID of JShellToolProvider>
3. Choose "output reader" thread on Java Threads window
4. Click "Stack Memory" icon on "Java Threads" toolbar.
- Stack trace
```
Error while performing oopsDo for frame sp: 0x00007f80986cb630, unextendedSP: 0x00007f80986cb630, fp: null, pc: 0x00007f80c32edfeb
sun.jvm.hotspot.oops.UnknownOopException
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ObjectHeap.newOop(ObjectHeap.java:264)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.addAnnotation(HSDB.java:1098)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34$1.visitAddress(HSDB.java:1045)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet$MyVisitor.visitOopLocation(ImmutableOopMapSet.java:58)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet.allDo(ImmutableOopMapSet.java:230)
at jdk.hotspot.agent/sun.jvm.hotspot.compiler.ImmutableOopMapSet.oopsDo(ImmutableOopMapSet.java:179)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsCodeBlobDo(Frame.java:618)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsDo(Frame.java:444)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34.run(HSDB.java:1038)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.WorkerThread$MainLoop.run(WorkerThread.java:70)
at java.base/java.lang.Thread.run(Thread.java:844)
```
According to frame::oopmapreg_to_location(), Frame#oopMapRegToLocation() should be calculated with "VMRegImpl::stack_slot_size". Not address size.
I saw similar exception and call stack at reverse pointer calculation.