[kaffe] Bug Report: StackOverflowError and Collections

Jim Pick jim at kaffe.org
Tue Sep 2 19:52:01 PDT 2003


On Fri, 29 Aug 2003 18:14:00 -0700
"Jim Pick" <jim at kaffe.org> wrote:

> Hi,
> 
> I'm running into problems building ant from CVS (4/28/2003 00:00 UTC),
> on an x86 Linux machine with the defaults (jthreads/jit3).  It fails
> like this:
> 
> ... Building Ant Distribution
> Buildfile: build.xml
> 
> BUILD FAILED
> java.lang.StackOverflowError
>    <<No stacktrace available>>
> 
> Total time: 0 seconds
> java.lang.StackOverflowError
>    <<No stacktrace available>>
> ... Failed Building Ant Distribution !
> 
> It used to work.  I chased it down to this particular change (the
> Classpath Collections merge).  I tried increasing the stack size using
> the -ss option, but it didn't seem to help.
> 
> I'll try to debug this when I get time, but I thought I'd report it
> first.

Okay, I did some more legwork, and it appears that the problem appears
because Ant creates a subclass of Hashtable called
org.apache.tools.ant.util.LazyHashtable, which worked nicely with our
old implementation of Hashtable, but not with the new Classpath-based
implementation of Hashtable.

Basically, LazyHashtable.contains(Object value) calls
super.contains(Object value) in Hashtable, which in Classpath's
implementation, calls Hashtable.containsValue(Object value).
Unfortunately, LazyHashTable.containsValue(Ojbect value) overrides that,
just calling calling LazyHashTable.contains(Object value) again, and we
have a loop.

I'd post a snippet of the stack trace, but I had to use gdb and
-Xxdebug, so all the symbols are mangled and it's ugly.  :-)

The old Kaffe implementation of Hashtable didn't have the problem, since
it used a private HashMap, compare below:

LazyHashtable:

http://cvs.apache.org/viewcvs/ant/src/main/org/apache/tools/ant/util/LazyHashtable.java?rev=1.6&content-type=text/vnd.viewcvs-markup

Classpath's Hashtable

http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/util/Hashtable.java?rev=1.28&content-type=text/vnd.viewcvs-markup

Our old Hashtable:

http://www.kaffe.org/cgi-bin/viewcvs.cgi/kaffe/libraries/javalib/java/util/Hashtable.java?rev=1.26&content-type=text/vnd.viewcvs-markup

I don't know if Kaffe's old Hashtable implementation is more proper or
not, but at least it worked.  :-)

I'll cc: this to the classpath list.

Cheers,

 - Jim


 




More information about the kaffe mailing list