Stack overflow in AWTEventMulticaster (PR#96)

Pavel Roskin pavel_roskin at geocities.com
Sat Aug 21 04:12:35 PDT 1999


Hello, Godmar!

> I've been fighting with this problem all summer.
> 
> As I see it, there's two problems here.
> 
> First, the fact that traversing the AWTEventMulticaster tree
> is implemented recursively.  This is the root of all evil.
> Note that simply making remove non-recursive doesn't help cause
> the problem also shows up when events are delivered.
> 
> Second, the stack overflows occur when long multicast chains have
> formed.  This happens if listeners have added themselves repeatedly
> without checking that they've already been added.  This can be caused
> by different causes:
> 
> + an erroneous application that simply calls "addXXXListener" in a loop.
> + an application that calls such methods as "getGraphics()" in a loop
>   without disposing of the graphics objects it obtains.
> 
> I went through the awt code to identify the cases where awt objects
> register themselves as listeners without checking whether long chains
> may be formed.
> 
> Peter knows about the problem and will try to find a solution for 
> the affected parts of the awt.

Actually, I found that the Sun's JDK also uses recursion here.
However, as JDK consumes less stack space than Kaffe (especially
Kaffe-interpreter), the problem is visible only in Kaffe.

So there are two problems:
1) Low default stack space used by Kaffe compared to its needs.
2) Bug in jCVS-4.7.5 (which is obsoleted by newer versions)

There is no bug in AWTEventMulticaster

Pavel Roskin

PS. I'm still alive :-) but Geocities has just dumped ~550 messages
on me that should have come earlier :-(



More information about the kaffe mailing list