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

StackOverflowError causes JDK1.2G VM crash

    XMLWordPrintable

Details

    • sparc
    • solaris_2.5

    Description



      Name: szC45993 Date: 08/15/97



      JDK1.2G doesn't process StackOverflowError correctly.
      It causes VM crash with "Segmentation Fault".
      See JCK test tests/vm/concepts/exceptions/exceptions031/exceptions03101/exceptions03101.java

      Note that JDK 1.1.3/1.1.4 pass the test successfully.

      > set JH=/export/ld14/java/dest/jdk1.2G/solaris
      > $JH/bin/java -fullversion
      java full version "JDK1.2G"
      > $JH/bin/javac -d . exceptions03101.java
      > $JH/bin/java -verify exceptions03101
      Segmentation Fault (core dumped)
      > set JH=/export/ld14/java/dest/jdk1.1.4/solaris
      > $JH/bin/java -fullversion
      java full version "JDK-sparkler_B"
      > $JH/bin/java -verify exceptions03101
      OKAY!

      SOURCE:

      --------------------- exceptions03101.java
      //File: @(#)exceptions03101.java 1.1 97/07/15
      //Copyright 07/15/97 Sun Microsystems, Inc. All Rights Reserved

      //package javasoft.sqe.tests.vm.exceptions.exceptions031.exceptions03101;

      import java.io.PrintStream;

      public class exceptions03101 {

        public static int i1;

        public static int prc(int i) {


      if (i == 1979) {
      return prc(1979);
      } else {
      return 7;
      };

        }

        public static int run(String argv[], PrintStream out) {


      try{

      i1 = prc(1979);

      } catch (StackOverflowError e) {
      out.println("OKAY!");
      return 0;
      };

      out.println("BAD!");
      return 2;

        }

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

      ======================================================================

      Name: icC57033 Date: 09/03/97



      It seems like fixes for #4016967, #4031122 doesn't solve
      stack overflow problem yet. Let's change exceptions03101 test case
      using Jasm and increase stack size of "prc" method from 2 to 20000.

      Most of JDK versions execute this test incorrectly:

      1.1.1, 1.1.2G, 1.1.3F, 1.1.4 throw an InternalError instead StackOverflowError,
      1.2G throws Segmentation Fault,
      1.2H, 1.2I hangup.

      Status of #4016967, #4031122 is "integrated" but
      it's easy to change test example from #4016967 a little
      and show that bug is still here:
      ...
        public static void main(String[] args) {
          for (int j = 0; j < 200; j++) { // INCREASE FROM 20 TO 200
            System.out.println("Iteration " + j);
            awful(j);
          }
        }
      ...

      Then we have:
      1.1.1, 1.1.2G, 1.1.3F, 1.1.4 throw an InternalError
      1.2G throws Segmentation Fault,
      1.2H, 1.2I hangup.


      --------------------- exceptions03101.jasm
      public super class exceptions03101
      {
      // Compiled from "exceptions03101.java"
      // Compiler version 3.45;

      public static Field i1:I;

      public static Method prc:"(I)I"
      stack 20000 locals 1 // CHANGED FROM 2 TO 20000
      {
      iload_0;
      sipush 1979;
      if_icmpne L14;
      sipush 1979;
      invokestatic Method prc:"(I)I";
      ireturn;
      L14: bipush 7;
      ireturn;
      }

      public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 2 locals 2
      {
      try t12;
      sipush 1979;
      invokestatic Method prc:"(I)I";
      putstatic Field i1:"I";
      endtry t12;
      goto L21;
      catch t12 java/lang/StackOverflowError;
      pop;
      aload_1;
      ldc String "OKAY!";
      invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
      iconst_0;
      ireturn;
      L21: aload_1;
      ldc String "BAD!";
      invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
      iconst_2;
      ireturn;
      }

      public static Method main:"([Ljava/lang/String;)V"
      stack 2 locals 1
      {
      aload_0;
      getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
      invokestatic Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I";
      bipush 95;
      iadd;
      invokestatic Method java/lang/System.exit:"(I)V";
      return;
      }

      public Method "<init>":"()V"
      stack 1 locals 1
      {
      aload_0;
      invokespecial Method java/lang/Object."<init>":"()V";
      return;
      }

      } // end Class exceptions03101
      ---------------------

      ======================================================================

      Attachments

        Activity

          People

            sliangsunw Sheng Liang (Inactive)
            zsssunw Zss Zss (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: