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

server VM crashes after >= 13999 reps of Unsafe.invoke{Virtual|Special}

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • hotspot
    • None
    • beta
    • generic
    • generic

      The hotspot server VM included with promoted build 1.4-B34 dumps core when
      executing the attached code (a loop calling sun.misc.Unsafe.invokeVirtual or
      invokeSpecial) for more than 13998 repetitions. This problem does not appear
      to exist in the client VM.

      (The following output assumes sun.misc.Unsafe is included in bootclasspath):

        $ java -server -version

        java version "1.4.0beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b34)
        Java HotSpot(TM) Server VM (build 1.4-internal, mixed mode)

        $ cat Foo.java

        import java.lang.reflect.*;
        import sun.misc.Unsafe;

        public class Foo {
            static int i = 0;

            private void func() {
                i++;
            }

            public static void main(String[] args) throws Exception {
                int reps = Integer.parseInt(args[0]);
                Unsafe unsafe = Unsafe.getUnsafe();
                Method meth = Foo.class.getDeclaredMethod("func", new Class[0]);
                int key = unsafe.invocationKey(meth);
                Foo foo = new Foo();
                Object[] iargs = new Object[0];
                for (int i = 0; i < reps; i++) {
                    unsafe.invokeSpecial(Foo.class, key, foo, iargs);
                }
            }
        }

        $ javac Foo.java

        $ java -server Foo 13998

        $ java -server Foo 13999
        #
        # HotSpot Virtual Machine Error, Unexpected Signal 11
        # Please report this error at
        # http://java.sun.com/cgi-bin/bugreport.cgi
        #
        # Error ID: 4F533F534F4C415249530E435050079D 01
        #
        # Problematic Thread: prio=5 tid=0x9c5e0 nid=0xb runnable
        #
        Abort (core dumped)

      I've included the listed file, an equivalent example for Unsafe.invokeVirtual,
      and Unsafe.java in the attachment for this bug. Note that the crash occurs
      whenever the number of repetitions exceeds 13998, but never for 13998 and
      under.

            jrose John Rose
            mwarressunw Michael Warres (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: