jhsdb jstack cannot work correctly
Yasumasa Suenaga
yasuenag at gmail.com
Wed Aug 3 14:45:04 UTC 2016
Hi Jini,
Thank you for your advice!
I could get thread dump with this change:
-----------------
diff -r 5acd2b561936 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java Tue Aug 02 20:55:27 2016 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java Wed Aug 03 23:42:36 2016 +0900
@@ -48,7 +48,7 @@
private static final int SENDER_SP_OFFSET = 2;
// Interpreter frames
- private static final int INTERPRETER_FRAME_MIRROR_OFFSET = 2; // for native calls only
+ private static int INTERPRETER_FRAME_MIRROR_OFFSET;
private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1;
private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1;
private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET - 1;
@@ -74,7 +74,8 @@
}
private static synchronized void initialize(TypeDataBase db) {
- INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1;
+ INTERPRETER_FRAME_MIRROR_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1;
+ INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_MIRROR_OFFSET - 1;
INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
-----------------
I hope to resolve this issue ASAP.
Yasumasa
On 2016/08/03 22:23, Jini Susan George wrote:
> Hi Yasumasa,
>
> Thanks for noticing this. Regarding the illegal bci, you seem to be right. From a quick look, this looks like this came in with the introduction of interpreter_frame_mirror_offset. (https://bugs.openjdk.java.net/browse/JDK-8154580).
> From frame_x86.hpp, we have:
>
> ...
> 71 interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1,
> 72 interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1,
> 73 interpreter_frame_mirror_offset = interpreter_frame_method_offset - 1,
> 74 interpreter_frame_mdp_offset = interpreter_frame_mirror_offset - 1,
> 75 interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1,
> 76 interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1,
> 77 interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1,
> ...
>
> This does not match with what we have in share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java.
>
> 77 INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1;
> 78 INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
> 79 INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
> 80 INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
>
> We need to have the mirror offset reflected in the SA code also. I will file a bug for this and fix this.
>
> Thank you,
> Jini.
>
>
>> -----Original Message-----
>> From: Yasumasa Suenaga [mailto:yasuenag at gmail.com]
>> Sent: Wednesday, August 03, 2016 5:51 PM
>> To: serviceability-dev at openjdk.java.net
>> Subject: jhsdb jstack cannot work correctly
>>
>> Hi all,
>>
>> I use "jhsdb jstack" command in JDK 9 EA b129.
>> But it does not seem to work fine.
>>
>> I encountered two problems:
>>
>> 1. AssertionFailure: illegal bci
>> 2. Normal mode cannot work
>>
>>
>> 1. AssertionFailure: illegal bci
>> I saw error stack as below with JDK 9 EA b129 Linux x64:
>> -------------------
>> 0x00007fe06bd270c2 * java.lang.Object.wait(long) bci:-520544688
>> (Interpreted frame)
>> 0x00007fe06bd1a443 sun.jvm.hotspot.utilities.AssertionFailure: illegal bci
>> at sun.jvm.hotspot.utilities.Assert.that(jdk.hotspot.agent at 9-
>> ea/Assert.java:32)
>> at
>> sun.jvm.hotspot.oops.ConstMethod.getLineNumberFromBCI(jdk.hotspot.age
>> nt at 9-ea/ConstMethod.java:297)
>> at
>> sun.jvm.hotspot.oops.Method.getLineNumberFromBCI(jdk.hotspot.agent at 9-
>> ea/Method.java:282)
>> at sun.jvm.hotspot.tools.PStack.getJavaNames(jdk.hotspot.agent at 9-
>> ea/PStack.java:239)
>> at sun.jvm.hotspot.tools.PStack.run(jdk.hotspot.agent at 9-
>> ea/PStack.java:112)
>> -------------------
>>
>> jhsdb can parse compiled frame correctly. It seems to be a problem for
>> interpreter frame only.
>> What is the cause of this problem?
>> interpretedVFrame in HotSpot has changed the location to store BCP?
>>
>>
>> 2. Normal mode cannot work
>> "jhsdb jstack" should work as normal mode without being added --mixed
>> option.
>> However, this command always works as mixed mode.
>> I think we can fix as below:
>> -------------------
>> diff -r 5acd2b561936
>> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java
>> --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java
>> Tue Aug 02 20:55:27 2016 -0700
>> +++
>> b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java
>> Wed Aug 03 21:18:57 2016 +0900
>> @@ -68,6 +68,10 @@
>> }
>>
>> public void runWithArgs(String... args) {
>> + // We should recover these mode to default value.
>> + mixedMode = false;
>> + concurrentLocks = false;
>> +
>> int used = 0;
>> for (int i = 0; i < args.length; i++) {
>> if (args[i].equals("-m")) {
>> -------------------
>>
>>
>> Has someone worked for them?
>> If not so, and patch of 2. is correct, I file it to JBS and upload webrev.
>>
>>
>> Thanks,
>>
>> Yasumasa
>>
>>
More information about the serviceability-dev
mailing list