[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
> 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:



Classpath's Hashtable


Our old Hashtable:


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.


 - Jim


More information about the kaffe mailing list