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

the concurrently executed threads crash the HotSpot 2.0merlin on Win32

XMLWordPrintable

    • x86
    • windows_nt



      Name: dkC59003 Date: 02/01/2000


      The regression test (testbase_nsk) nsk/regression/b4296365 crashes
      the HotSpot Server VM (2.0merlin, build A) on win32.

      The test generates the four concurrently executrd threads and expects
      these threads to finish succesfully, but the HotSpot VM crashes.

      See test source below.

      With -Xint option the test passes.

      The Classic VM passes the test as well as the
      HotSpot Server VM (2.0rc1,build I).

      See log:

      % d:\export\java\jdk1.2.2\win32\bin\java -version
      java version "1.2.2"
      Java HotSpot(TM) Server VM (2.0merlin, mixed mode, build A)

      % d:\export\java\jdk1.2.2\win32\bin\java 4296365
      ==> Test b4296365 LOG:
      ----> All Threads have started: 4 threads!
      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      #
      # Error ID: 4F533F57494E13120E43505002D9
      #
      # Problematic Thread: prio=5 tid=0x8a0c30 nid=0xcf runnable
      #
      (Error ID: os_win32.cpp, 729)


      % d:\export\java\jdk1.2.2\win32\bin\java -classic -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      % d:\export\java\jdk1.2.2\win32\bin\java -classic 4296365
      ==> Test b4296365 LOG:
      ----> All Threads have started: 4 threads!
      ----> Alive Threads Number is 2
      ----> Alive Threads Number is 0
      ----> All Threads have finished!
      ==> Test b4296365 PASSED!


      % d:\export\java\jdk1.2.2\win32\bin\java -version
      java version "1.2.2"
      Java HotSpot(TM) Server VM (2.0rc1, mixed mode, build I)

      % d:\export\java\jdk1.2.2\win32\bin\java 4296365
      ==> Test b4296365 LOG:
      ----> All Threads have started: 4 threads!
      ----> Alive Threads Number is 2
      ----> Alive Threads Number is 0
      ----> All Threads have finished!
      ==> Test b4296365 PASSED!



      --------------------- java source ------------------------------
      import javax.swing.*;

      public class b4296365 {
          static short[] cacheData = new short[500000];

          static private int[] lengths =
          {
              1, 10, 100, 1000, 10000, 100000
          };
          static Thread[] v_threads =
          {
              null, null, null, null
          };

          static public int test_method() throws Exception {
              JFrame frame = new JFrame();
              final JTextArea textArea = new JTextArea();
              JScrollPane scroll = new JScrollPane(textArea);
              frame.getContentPane().add(scroll);
              frame.setSize (300, 300);
              frame.setVisible (true);

              for (int t = 0; t < 4; ++t)
              {
                  v_threads[t] = new Thread(new Runnable()
                  {
                      public void run ()
                      {
                          try
                          {
                          int j = 0;
                          for (int K = 0; K < 100; ++K)
                          {
                              for (int i = 0; i < lengths.length; ++i)
                              {
                                  final int jj = j;
                                  short[] data = new short[lengths[i]];
                                  for (int z = 0; z < data.length; ++z)
                                      data[z] = (short)(4000 + i + z);

                                  short[] data2 = new short[lengths[i]];
                                  for (int i1 = 0; i1 < data.length; ++i1)
                                      cacheData[(i1 + 50000) % cacheData.length] = data[i1];

                                  for (int i2 = 0; i2 < data.length; ++i2)
                                      data2[i2] = cacheData[(i2 + 50000) % cacheData.length];

                                  SwingUtilities.invokeAndWait (new Runnable()
                                  {
                                      public void run()
                                      {
                                          textArea.append ("Made some progress..." + jj + "\n");
                                      }
                                  });
                              }
                              ++j;
                          }
                          }
                          catch (Exception e)
                          {
                          }
                      }
                  });
                  v_threads[t].start();
              }
      System.out.println("----> All Threads have started: 4 threads!");

              int threads_finished_num=0;
              int alive_threads_num=4;
              while (threads_finished_num < 4) {
                  threads_finished_num=0;
                  for (int l = 0; l < 4; l++) {
                      if (! v_threads[l].isAlive() ) threads_finished_num++;
                  }
                  if ( 4 - threads_finished_num != alive_threads_num ) {
                      alive_threads_num = 4 - threads_finished_num;
                      System.out.println("----> Alive Threads Number is " + alive_threads_num);
                  }
                  try {
                      Thread.sleep(1000); // sleep for 1 second
                  }
                  catch (InterruptedException e) {
                  }
              }
      System.out.println("----> All Threads have finished!");
      return 0/*STATUS_PASSED*/;

          } // end of test_method

          public static int run(String argv[], java.io.PrintStream out) {
      System.out.println("==> Test b4296365 LOG:");
              try {
                  test_method();
              }
              catch (Exception e) {
              }
      System.out.println("==> Test b4296365 PASSED!");
              return 0/*STATUS_PASSED*/;
          }

          public static void main(String argv[]) {
      System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
          }

      } // end of b4296365 class

      ----------------------------------------------------------------
       
      ======================================================================

            jrose John Rose
            dkhukhrosunw Dmitry Khukhro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: