Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8211030

jdb crashes in jni_IsInstanceOf when setting value type field to itself

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • repo-valhalla
    • repo-valhalla
    • core-svc
    • None

    Description

      1. Compile the sample test.
      2. Start jdb:
      $ jdb -classpath . -XX:+EnableValhalla Test
      3. Set breakpoint on the line with System.out.println()
      > stop at Test:11
      4. Run to breakpoint
      > run
      5. Invoke "set" cmd
      > set v1.v2=v1.v2

      Expected result:
      java.lang.IllegalArgumentException: Cannot set value of final field

      Actual result:
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00000001037f7144, pid=63500, tid=42755
      #
      # JRE version: OpenJDK Runtime Environment (12.0) (build 12-internal+0-adhoc.datitov.valhalla)
      # Java VM: OpenJDK 64-Bit Server VM (12-internal+0-adhoc.datitov.valhalla, mixed mode, compressed oops, g1 gc, bsd-amd64)
      # Problematic frame:
      # V [libjvm.dylib+0x3f7144] jni_IsInstanceOf+0xa2
      #
      # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # An error report file with more information is saved as:
      # /Users/datitov/src/valhalla/hs_err_pid63500.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #
      com.sun.jdi.VMDisconnectedException
      at jdk.jdi/com.sun.tools.jdi.TargetVM.waitForReply(TargetVM.java:310)
      at jdk.jdi/com.sun.tools.jdi.VirtualMachineImpl.waitForTargetReply(VirtualMachineImpl.java:1145)
      at jdk.jdi/com.sun.tools.jdi.PacketStream.waitForReply(PacketStream.java:87)
      at jdk.jdi/com.sun.tools.jdi.JDWP$ObjectReference$GetValues.waitForReply(JDWP.java:4519)
      at jdk.jdi/com.sun.tools.jdi.JDWP$ObjectReference$GetValues.process(JDWP.java:4489)
      at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.getValues(ObjectReferenceImpl.java:229)
      at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.getValue(ObjectReferenceImpl.java:183)
      at jdk.jdi/com.sun.tools.example.debug.expr.LValue$LValueInstanceMember.getValue(LValue.java:496)
      at jdk.jdi/com.sun.tools.example.debug.expr.LValue.interiorGetValue(LValue.java:136)
      at jdk.jdi/com.sun.tools.example.debug.expr.LValue.setValue(LValue.java:86)
      at jdk.jdi/com.sun.tools.example.debug.expr.ExpressionParser.Assignment(ExpressionParser.java:264)
      at jdk.jdi/com.sun.tools.example.debug.expr.ExpressionParser.Expression(ExpressionParser.java:229)

      The application has been disconnected
      at jdk.jdi/com.sun.tools.example.debug.expr.ExpressionParser.evaluate(ExpressionParser.java:75)
      at jdk.jdi/com.sun.tools.example.debug.tty.Commands.evaluate(Commands.java:114)
      at jdk.jdi/com.sun.tools.example.debug.tty.Commands.doPrint(Commands.java:1653)
      at jdk.jdi/com.sun.tools.example.debug.tty.Commands$3.action(Commands.java:1679)
      at jdk.jdi/com.sun.tools.example.debug.tty.Commands$AsyncExecution$1.run(Commands.java:66)
       v1.val1 = v1.val1 = null



      ================================
      public class Test {


        public static void main(String[] args){

            MyValue2 v2 = new MyValue2(12,'c');
            MyValue1 v1 = new MyValue1(v2);

            System.out.println("v1 = " + v1);
            System.out.println("v2 = " + v2);
        }

          public final __ByValue static class MyValue1 {
              MyValue2 val1;
              public MyValue1(MyValue2 v){
                val1 = v;
              }
          }

          public final __ByValue static class MyValue2 {
              int a;
              char b;

              public MyValue2(int a, char b){
                this.a = a;
                this.b = b;
              }
          }
          
      }

      Attachments

        Issue Links

          Activity

            People

              fparain Frederic Parain
              dtitov Daniil Titov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: