JDK-4167055 : infinite recursion in FindClass
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1,windows_nt
  • CPU: x86,sparc
  • Submitted: 1998-08-18
  • Updated: 1999-04-13
  • Resolved: 1999-04-13
Related Reports
Duplicate :  
Description

Name: laC46010			Date: 08/17/98



The following test fails on Solaris VM (1.2beta4-1.2fcsF)
with core dump:
Segmentation Fault (core dumped) if JIT is enabled.
If it is off, test hangs for indefinite period. In some
cases it also crashes to Segmentation Fault
while CTRL-C. is pressed. On Win32 this example
returns wrong status. The modified one leads to crash
(commented line in example).

Test example and VM diagnostics follow:
-------------------------------------------------------
novo35% cat test.java
import java.io.PrintStream;
public class test {
   static int r = 1;
   public static void main(String argv[]) {
        System.exit(run(argv, System.out));
    }
    public static int run(String argv[], PrintStream out) {
       try {
          try {
             r++;
             if ( r>58161 ) out.println("r=" + r + "  ");
             // if ( r%100 == 0 ) out.println("r=" + r + "  ");
/*Crashes on NT*/
             run(argv,out);
          } catch ( StackOverflowError e) {
             System.out.println("Recursion depth: " + r);
             return 0;
          }
       } catch (Throwable e) {
          System.out.println("Error! Exception : " + e);
          return 2;
       }
       return 2;
    }
}
novo35% java -version
java version "1.2fcs"
Classic VM (build JDK-1.2fcs-F, green threads, sunwjit)
novo35% javac test.java
novo35% java -verify test
r=58162
Segmentation Fault

B:\ld22\java\sns\run>B:\ld14\java\dest\jdk1.2fcsE\win32\bin\java
-version
java version "1.2fcs"
Classic VM (build JDK-1.2fcs-E, native threads)
B:\ld22\java\sns\run>B:\ld14\java\dest\jdk1.2fcsE\win32\bin\javac
test.java
B:\ld22\java\sns\run>B:\ld14\java\dest\jdk1.2fcsE\win32\bin\java -verify
test
Status=128

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

Comments
EVALUATION I also ran test/vm/misc/JavaStackOverflow.java on Solaris green threads VM and that fails as well -- I get a NullPointerException (my guess is that the SIGSEGV due to stack overflow is being translated into a NullPointerException incorrectly by the JIT). I have not tried to reproduce the submitter's program on Win32, but there should be a seperate bug under jit_symantec for this. anand.palaniswamy@Eng 1998-08-18 It does indeed crash under the JIT but it also crashes without the JIT if you let it run long enough. The problem is that because of the VM is almost in a stack overflow state it can't execute it's error handling code path to throw a ClassNotFoundException so it recurses, repeatedly trying to find ClassNotFoundException. There may indeed be problems with the JIT but they can't be fixed until the underlying problem in the VM is fixed. Here's an example call stack: =>[1] fillInStackTrace(o = 0xebc9b050, ee = 0x28bf8), line 1264 in "jvm.c" [2] SignalError(ee = 0x28bf8, ename = 0xef7155e0 "java/lang/StackOverflowError", DetailMessage = (nil)), line 1097 in "classruntime.c" [3] ThrowStackOverflowError(ee = (nil), s = (nil)), line 121 in "common_exceptions.c" [4] ExpandJavaStack(ee = 0x28bf8, stackP = 0xeffed380, frameP = 0xeffed37c, optopP = (nil), args_size = 0, nlocals = 0, maxstack = 7), line 245 in "interpreter.c" [5] ExpandJavaStackForJNI(ee = 0x28bf8, stackP = 0xeffed380, frameP = 0xeffed37c, capacity = 7), line 215 in "interpreter.c" [6] jni_PushLocalFrame(env = 0x28bf8, capacity = 4), line 1164 in "jni.c" [7] checked_jni_PushLocalFrame(env = 0x28bf8, capacity = 4), line 302 in "check_jni.c" [8] ClassLoaderFindClass(ee = 0x28bf8, loader = 0xebc99410, name = 0xef71506c "java/lang/ClassNotFoundException"), line 1727 in "classresolver.c" [9] FindClassFromClassLoader(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, loader = 0xebc99410, throwError = TRUE), line 1902 in "classresolver.c" [10] FindClassFromClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, from = 0xebc9c250), line 1993 in "classresolver.c" [11] FindClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE), line 1850 in "classresolver.c" [12] FindClassFromClassLoader(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, loader = 0xebc99410, throwError = TRUE), line 1913 in "classresolver.c" [13] FindClassFromClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, from = 0xebc9c250), line 1993 in "classresolver.c" [14] FindClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE), line 1850 in "classresolver.c" [15] FindClassFromClassLoader(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, loader = 0xebc99410, throwError = TRUE), line 1913 in "classresolver.c" [16] FindClassFromClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, from = 0xebc9c250), line 1993 in "classresolver.c" [17] FindClass(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE), line 1850 in "classresolver.c" [18] FindClassFromClassLoader(ee = 0x28bf8, name = 0xef71506c "java/lang/ClassNotFoundException", resolve = TRUE, loader = 0xebc99410, throwError = TRUE), line 1913 in "classresolver.c" There are several hundred more frames below this. tom.rodriguez@Eng 1998-08-25
25-08-1998