Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
11 replies Latest Post - ‏2013-02-11T01:11:38Z by SystemAdmin
SystemAdmin
SystemAdmin
2736 Posts
ACCEPTED ANSWER

Pinned topic VerifyError: JVMVRFY012 stack shape inconsistent

‏2013-01-23T19:40:01Z |
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)
at java.lang.J9VMInternals.verify(J9VMInternals.java:90)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
at Test.<init>(Test.java:11)
at Test.main(Test.java:7)
Updated on 2013-02-11T01:11:38Z at 2013-02-11T01:11:38Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2736 Posts
    ACCEPTED ANSWER

    Re: VerifyError: JVMVRFY012 stack shape inconsistent

    ‏2013-01-25T08:32:01Z  in response to SystemAdmin
    For verification, did you try with the previous release JDK 1.6? What is the result?

    If you can share the testcase, I will look into this issue?
    • SystemAdmin
      SystemAdmin
      2736 Posts
      ACCEPTED ANSWER

      Re: VerifyError: JVMVRFY012 stack shape inconsistent

      ‏2013-01-26T02:16:26Z  in response to SystemAdmin
      Yes - 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)
      at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
      at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
      at Test.<init>(Test.java:11)
      at Test.main(Test.java:7)

      With the Sun JVM you will get the following expected result.

      Exception in thread "main" com.foo.foo_c
      at com.foo.Bar.foo(Bar.java:4522)
      at Test.<init>(Test.java:12)
      at Test.main(Test.java:7)

      Any insights would be greatly appreciated.

      Attachments

      • SystemAdmin
        SystemAdmin
        2736 Posts
        ACCEPTED ANSWER

        Re: VerifyError: JVMVRFY012 stack shape inconsistent

        ‏2013-01-28T07:45:58Z  in response to SystemAdmin
        I 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"
        "-Xdump:java:events=throw+systhrow,range=1..1,filter=java/lang/VerifyError"
        -Xtrace:maximal=all,output=<<file name>>
        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.
        • SystemAdmin
          SystemAdmin
          2736 Posts
          ACCEPTED ANSWER

          Re: VerifyError: JVMVRFY012 stack shape inconsistent

          ‏2013-01-29T10:59:09Z  in response to SystemAdmin
          Try downloading the Test0.jar using the following URL.

          http://tinyurl.com/Test0-jar

          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
          • SystemAdmin
            SystemAdmin
            2736 Posts
            ACCEPTED ANSWER

            Re: VerifyError: JVMVRFY012 stack shape inconsistent

            ‏2013-01-29T11:06:07Z  in response to SystemAdmin
            You need to quote whole option since it contains a space.

            e.g.

            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
          • SystemAdmin
            SystemAdmin
            2736 Posts
            ACCEPTED ANSWER

            Re: VerifyError: JVMVRFY012 stack shape inconsistent

            ‏2013-01-30T07:58:29Z  in response to SystemAdmin
            I am able to download the testcase from the link. I will update you once I completed the debugging.

            Thank you
            • SystemAdmin
              SystemAdmin
              2736 Posts
              ACCEPTED ANSWER

              Re: VerifyError: JVMVRFY012 stack shape inconsistent

              ‏2013-01-30T23:50:54Z  in response to SystemAdmin
              Thank 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.
              • SystemAdmin
                SystemAdmin
                2736 Posts
                ACCEPTED ANSWER

                Re: VerifyError: JVMVRFY012 stack shape inconsistent

                ‏2013-02-07T12:18:37Z  in response to SystemAdmin
                I 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.

                Thanks
                • SystemAdmin
                  SystemAdmin
                  2736 Posts
                  ACCEPTED ANSWER

                  Re: VerifyError: JVMVRFY012 stack shape inconsistent

                  ‏2013-02-07T21:27:34Z  in response to SystemAdmin
                  The 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.
                  • SystemAdmin
                    SystemAdmin
                    2736 Posts
                    ACCEPTED ANSWER

                    Re: VerifyError: JVMVRFY012 stack shape inconsistent

                    ‏2013-02-08T10:09:32Z  in response to SystemAdmin
                    5920: 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
                    5948: athrow
                    5949: astore 17
                    5951: jsr 5957
                    5954: aload 17
                    5956: athrow
                    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
                    5972: athrow
                    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.
                    • SystemAdmin
                      SystemAdmin
                      2736 Posts
                      ACCEPTED ANSWER

                      Re: VerifyError: JVMVRFY012 stack shape inconsistent

                      ‏2013-02-11T01:11:38Z  in response to SystemAdmin
                      Sorry - 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.