I am getting a "VerifyError: JVMVRFY012 stack shape inconsistent" error from the IBM Java 7 JVM on Linux. Exactly the same bytecode runs with no problems on the Oracle/Sun Java 7 JVM. Also the same bytecode is given the all clear by the BCEL verifier. I have pasted the JVM version info and the full stack trace below.
Can some one tell me.
1) Exactly what might cause a "JVMVRFY012 stack shape inconsistent" error message,
2) What the "pc=6761" means and how I can use it to find out exactly where in the method Code attribute the problem is,
3) How I can otherwise get more information on the nature of the problem,
4) Whether this is perhaps a know bug in the IBM JVM.
I can upload a test cse if this would help.
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470-20110827_01)
IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 20110810_88604 (JIT enabled, AOT enabled)
J9VM - R26_Java726_GA_20110810_1208_B88592
JIT - r11_20110810_20466
GC - R26_Java726_GA_20110810_1208_B88592
J9CL - 20110810_88604)
JCL - 20110809_01 based on Oracle 7b147
Exception in thread "main" java.lang.VerifyError: JVMVRFY012 stack shape inconsistent; class=com/foo/bar, method=foo(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;, pc=6761
at java.lang.J9VMInternals.verifyImpl(Native Method)
This topic has been locked.
11 replies Latest Post - 2013-02-11T01:11:38Z by SystemAdmin
Pinned topic VerifyError: JVMVRFY012 stack shape inconsistent
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-02-11T01:11:38Z at 2013-02-11T01:11:38Z by SystemAdmin
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-01-26T02:16:26Z in response to SystemAdminYes - I did try with the following IBM JDK 1.6.0 but with the same result.
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr9-20110624_85526 (JIT enabled, AOT enabled)
I have attached the test case Test0.jar. I have had to obfuscate the names for confidentiality reasons. You can execute the test case in the following way.
java -cp Test0.jar:j2ee.jar Test
With the IBM JVM you will get the following.
Exception in thread "main" java.lang.VerifyError: JVMVRFY012 stack shape inconsistent; class=com/foo/Bar, method=foo(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;, pc=5495
at java.lang.J9VMInternals.verifyImpl(Native Method)
With the Sun JVM you will get the following expected result.
Exception in thread "main" com.foo.foo_c
Any insights would be greatly appreciated.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-01-28T07:45:58Z in response to SystemAdminI am not able to download the testcase due to some reason(download failing in middle). I will retry sometime later today.
or recreate the problem with the following options,
"-Xdump:tool:events=throw+systhrow,range=1..1,filter=java/lang/VerifyError,exec=gcore -o system_dump_using_gcore.dmp %pid"
where <<file name>>, provide absolute file name to collect the JVM logs
provide all the logs(javacore, snap trace & core file).
If you have support contract, you can open PMR with IBM. It will help you to get quick resolution.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-01-29T10:59:09Z in response to SystemAdminTry downloading the Test0.jar using the following URL.
Tried using your options but got the following error. Will try again if you still cannot download the test case.
JVMJ9VM007E Command-line option unrecognised: -o
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-01-29T11:06:07Z in response to SystemAdminYou need to quote whole option since it contains a space.
java -cp . "-Xdump:tool:events=throw+systhrow,range=1..1,filter=java/lang/VerifyError,exec=gcore -o system_dump_using_gcore.dmp %pid" -jar Test0.jar
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-01-30T23:50:54Z in response to SystemAdminThank you. I would greatly appreciate it if you could tell me exactly what has triggered the error and the relevant offset(s) in the Code attribute of the method. Even if the VerifyError is the result of a bug in the verifier, I will need to be able to work around it. Thank you once more.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-02-07T12:18:37Z in response to SystemAdminI haven't found the reason for the error yet.
Meanwhile for quick verification, can you recompile that particular class"com/foo/Bar" using the latest java compiler & verify the behavior. The reason for asking this, the classfile has reference to jsr bytecode & doubt the J9 jsr Inliner for the verify error.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-02-07T21:27:34Z in response to SystemAdminThe code belongs to a customer. The customer says that they used the Oracle JDK 1.7.0_11 compiler with target/source 1.5. When I compiled the customer code in my environment using the Oracle JDK 1.7.0_09 then there was no problem.
The bottom line is that if it is a IBM JIT bug which only occurs in very unusual circumstances (to do with the customer's compile environment) then maybe it is not worth your time digging any further.
To clarify this - are you able to tell me what the "reference to jsr bytecode" is exactly? I scanned the bytecode but couldn't see anything obvious.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-02-08T10:09:32Z in response to SystemAdmin5920: jsr 5957
5923: goto 5975
5926: astore 8
5928: getstatic #1; //Field foo_a:Lcom/foo/foo_gf;
5945: invokespecial #425; //Method com/foo/foo_c."<init>":(Ljava/lang/String;Ljava/lang/Throwable;)V
5949: astore 17
5951: jsr 5957
5954: aload 17
5957: astore 18
5959: aload 7
5961: ifnull 5973
5964: aload 7
5966: invokevirtual #1723; //Method com/foo/foo_xd.foo_c:()V
5969: goto 5973
5973: ret 18
above output from javap -c -v -p <<ClassName>>, Referenced to these two "jsr" & "ret" bytecode. It requires special processing within J9 VM to execute/handle these two bytecodes. These bytecodes are deprecated & compilers(/later version of classfiles) don't expect to generate code using these bytecodes.
Re: VerifyError: JVMVRFY012 stack shape inconsistent2013-02-11T01:11:38Z in response to SystemAdminSorry - I misunderstood. By jsr I thought you where referring to a Java JSR as in Java Specification Request. Anyway, when I recompile the customer's source, I cannot reproduce the problem. I can only get the problem to occur if I use the compiled class file provided by the customer. So the problem is strangely subtle. The customer will be putting out a new release in a few months so I will wait to see if their recompiled class file still displays the same problem.
In the interim, I will mark my questions as answered. Thank you for all your help.