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

116 regress: Symantec JIT crashed the VM under agressive GC test on Win32.

XMLWordPrintable

    • 1.1.6
    • x86
    • windows_nt
    • Verified

      When running ThreadGCBug test with JDK1.1.6 K build, with Symantec JIT turned on. The VM crashed right away. The test can never run more than 5 second. But the same test can run for weeks under interpreter. The following is the source code, compiler it and run with
      java -Djava.compiler=symcjit ThreadGCBug

      class T implements Runnable {
        static int nInstance = 0;
        synchronized public static int getNInstance() {return nInstance;}
        synchronized public static int incNInstance() {return nInstance++;}
        synchronized public static int decNInstance() {return nInstance--;}
        
        public void run2(String a[], String a1[], int sz, String sum) {
            int i;
            for(i=0;i<sz;i++)
              a1[i] = null;
            int s = 0;
            int inc;
            String b;
            for (i=0;i<sz;i++) {
              inc = a[i].length();
      if (!a[i].regionMatches(0, sum, s, inc)) {
                System.out.print ("failed: i = " + i + "\n");
                System.out.print (" a[i] = " + a[i] + "\n");
                b = sum.substring(s, s+inc);
                System.out.print (" b = " + b + "\n");
      int j;
      for (j=0;j<inc;j++)
      System.out.print ((int)(a[i].charAt(j)) + " " + (int)(b.charAt(j)) + "\n");
                break;
              }
              s += inc;
            }
        }

        public void run1(int pass) {
            int i;
            int res;
            int sz = 121;
            String[] a = new String [sz];
            String[] a1 = new String [sz];
            String sum = "1";

            a[0] = "1";
            for (i=1;i<sz;i++) {
              a[i] = a[i-1] + i;
              a1[i] = sum;
              sum = sum + a[i];
            }
            run2(a,a1,sz,sum);
            System.out.print (Thread.currentThread() + ": pass " + pass + "\n");
        }
        public void run() {
            try {
            int i;
            int n = (int)(10.0 * Math.random());
            for(i=0;i<n;i++)
              run1(i);
            decNInstance();
      } catch (Throwable t) {
      t.printStackTrace();
      }
        }
      }


      class HT implements Runnable {

        public void run() {
            while(true) {
      try {
                Thread.sleep(50);
              } catch (Exception e) {
      e.printStackTrace();
      }
            }
        }
      }

      class ThreadGCBug {
        public static void main1 (String[] args) {
          Thread ht = new Thread(new HT());
          ht.setPriority(7);
          ht.start();
          while (true) {
            T.incNInstance();
            Thread t = new Thread(new T());
            t.start();
            while (T.getNInstance() > 2) {
              try {Thread.sleep(100);}
      catch (Exception e) {
      e.printStackTrace();
      }
            }
          }
        }
        public static void main (String[] args) {
          main1(args);
          int i;
          for (i=0;i<10000;i++) {
            int a[] = new int [100];
            a [9] = i;
          }
      try{Thread.sleep(100000);} catch (Throwable e) {}
        }
      }

            dviswanasunw Deepa Viswanathan (Inactive)
            hongzh Hong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: