[kaffe] Bug in Kaffe 1.1.4 handling of Stack Overflow.

Steven Augart augart at watson.ibm.com
Thu Mar 11 11:45:03 PST 2004


I'm using Kaffe 1.1.4.

If I compile and run the following test program under Kaffe 1.1.4,
Kaffe exits with status 0 (normal exit).

It should instead throw a java.lang.StackOverflowError and print out a
backtrace.

The program, Bad.java:

    class Bad {
      public static void main(String[] args) {
	emit(1);
      }
      static void emit(int i) {
	emit(i);
      }
    }


Here's what Kaffe does:

    $ kaffe -Xmx50M Bad 
    $ echo $?
    0

Here's what the Sun JDK does:

    $ java -Xmx50M Bad
    Exception in thread "main" java.lang.StackOverflowError
	    at Bad.emit(Bad.java:6)
 [previous line repeats 1023 more times]

And here's what Jikes RVM does (not that I'm trying to push us as
normative!):

    $ rvm -Xmx50M Bad
    Ljava/lang/StackOverflowError;
	    at Bad.emit(Bad.java; machine code offset: 0x0000002C)
	    at Bad.emit(Bad.java:6)
 [ previous line repeats 98 times ]
	    ...7349 stackframes omitted.
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.emit(Bad.java:6)
	    at Bad.main(Bad.java:3)
	    at com.ibm.JikesRVM.MainThread.run(MainThread.java:102)
    JikesRVM: exit 113
    $ echo $?
    113

I tried the command (thank you, Dalibor):

   kaffe -vmdebug ELOOKUP -Xmx50M Bad >| kaffe-vmdebug.out 2>&1

and got this in kaffe-vmdebug.out (which was 836 KB long):
    dispatchException(): java/lang/ClassNotFoundException
    kaffe/lang/PrimordialClassLoader.findClass0 has no handlers.
    kaffe/lang/PrimordialClassLoader.findClass has no handlers.
    kaffe/lang/PrimordialClassLoader.loadClass has no handlers.
    java/lang/ClassLoader.loadClass has 1 handlers (throw was pc=0x822b55e):
      Handler 0 covers 0x822b474-0x822b573
      Found matching handler at 0x822b578: Handles java/lang/ClassNotFoundException.
    dispatchException(): java/lang/StackOverflowError
    Bad.emit has no handlers.
 [32632 repetitions of the previous line]
    dispatchException(): java/lang/ArrayStoreException
    java/lang/System.arraycopy has no handlers.
    java/lang/String.getChars has no handlers.
    java/lang/StringBuffer.append has no handlers.
    java/lang/StackTraceElement.toString has no handlers.
    java/lang/Throwable.stackTraceStringBuffer has no handlers.
    java/lang/Throwable.stackTraceString has no handlers.
    java/lang/Throwable.printStackTrace has no handlers.
    java/lang/Throwable.printStackTrace has no handlers.





More information about the kaffe mailing list