4 issues for HSDB
Yasumasa Suenaga
yasuenag at gmail.com
Thu Aug 31 14:49:11 UTC 2017
Hi all,
I attached HSDB to jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider . However, I found 4 issues.
I propose patches for them, but they are not yet filed to JBS. I want to file and to send review request after this discussion.
1. Java Stack cannot be shown.
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/conflict-type/
- How to reproduce
Choose "main" thread and click "Show Java stack trace" icon on "Java Threads" toolbar.
- Stack trace
```
Exception in thread "AWT-EventQueue-0" sun.jvm.hotspot.utilities.AssertionFailure: type check
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.StackValue.getObject(StackValue.java:59)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.StackValueCollection.oopHandleAt(StackValueCollection.java:51)
at jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser.HTMLGenerator.genHTMLForJavaStackTrace(HTMLGenerator.java:1931)
at jdk.hotspot.agent/sun.jvm.hotspot.ui.JavaStackTracePanel.setJavaThread(JavaStackTracePanel.java:78)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB.showJavaStackTrace(HSDB.java:1526)
```
I guess it is caused by inlined method which is generated by JIT compiler.
StackValue has T_CONFLICT value. It might be able to skip.
I'm not sure about this. So I need comments.
2. ArrayIndexOutOfBoundsException is occurred on Stack Memory window
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/indy/
- How to reproduce
Choose "main" thread and click "Stack Memory" icon on "Java Threads" toolbar.
- Stack trace
```
Error while performing oopsDo for frame sp: 0x00007f80db89e590, unextendedSP: 0x00007f80db89e598, fp: 0x00007f80db89e5e8, pc: 0x00007f80bb7abf00
java.lang.ArrayIndexOutOfBoundsException: 384 57
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.GenericArray.getIntegerAt(GenericArray.java:82)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.U2Array.at(U2Array.java:59)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPool.invokedynamicCPCacheIndex(ConstantPool.java:278)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPool.invokedynamicCPCacheEntryAt(ConstantPool.java:283)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPool.implNameAndTypeRefIndexAt(ConstantPool.java:292)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPool.implGetSignatureRefAt(ConstantPool.java:264)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPool.getSignatureRefAt(ConstantPool.java:256)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.doMethod(GenerateOopMap.java:1731)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.interp1(GenerateOopMap.java:1386)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.interpBB(GenerateOopMap.java:803)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.interpAll(GenerateOopMap.java:1109)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.doInterpretation(GenerateOopMap.java:982)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.GenerateOopMap.computeMap(GenerateOopMap.java:2199)
at jdk.hotspot.agent/sun.jvm.hotspot.interpreter.OopMapForCacheEntry.computeMap(OopMapForCacheEntry.java:80)
at jdk.hotspot.agent/sun.jvm.hotspot.interpreter.OopMapCacheEntry.fill(OopMapCacheEntry.java:53)
at jdk.hotspot.agent/sun.jvm.hotspot.oops.Method.getMaskFor(Method.java:261)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsInterpretedDo(Frame.java:588)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Frame.oopsDo(Frame.java:440)
at jdk.hotspot.agent/sun.jvm.hotspot.HSDB$34.run(HSDB.java:1038)
```
It seems to relate to JDK-8175816.
I guess SA handles incorrect data for ConstantPool for indy. It should be handled like invokedynamic_cp_cache_index().
3. UnknownOopException is occurred on Stack Memory window
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/oopmap/
- How to reproduce
Choose "output reader" thread and 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.
4. [Unknown generation] is shown in Stack Memory for output reader thread
- Suggested fix
http://cr.openjdk.java.net/~ysuenaga/hsdb-fix/stackmemory-g1/
- How to reproduce
Choose "output reader" thread and click "Stack Memory" icon on "Java Threads" toolbar.
HSDB.java is not handles G1CollectedHeap. So it is not detect the generation of oop.
Thanks,
Yasumasa
More information about the serviceability-dev
mailing list